Home >Operation and Maintenance >Docker >How to solve the problem that ngnix cannot start in Docker

How to solve the problem that ngnix cannot start in Docker

WJ
WJOriginal
2020-06-08 16:52:333459browse

How to solve the problem that ngnix cannot start in Docker

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn