Docker ngnix cannot start?
I created a new docker container and when I modified the nginx configuration file, there was a missing semicolon and the nginx configuration was incorrect, causing the nginx container to fail to start.
Because the container has not been started, you cannot enter the container to make changes.
How to check the docker container that reports an error: docker logs container name
The solution is as follows:
1. First copy the configuration in the container
docker cp my-nginx:/etc/nginx/conf.d/nginx.conf /root/Downloads
2. Modify the files in the copied directory
cd /root/Downloads vim nginx.conf
3. After the modification is completed, replace the configuration file in the container
docker cp nginx.conf my-nginx:/etc/nginx/conf.d/nginx.conf
Note: My file name here is nginx.conf , pay attention to the actual configuration file name in your container. Such as: default.conf
Related recommendations: docker tutorial
The above is the detailed content of How to solve the problem that ngnix cannot start in Docker. For more information, please follow other related articles on the PHP Chinese website!