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
Release: 2020-06-08 16:52:33
Original
3471 people have browsed it

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
Copy after login

2. Modify the files in the copied directory

 cd /root/Downloads
 vim nginx.conf
Copy after login

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
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template