I have a docker container that runs nginx on debian. In response to some input, I need to restart the nginx service but not the whole container. Running "service nginx restart" blows the whole container away.
Is there any way to restart a service in a docker container without restarting the whole container?
You can go inside the container and restart the nginx
sudo docker exec –it nginx-container /bin/bash
Of course it's recommended to rebuild the container when you do the changes, but I recommend reload
ing the nginx
service with either running bash
inside of container and then reload it:
sudo docker exec -it NGINX_NAME bash
Then run service nginx reload
.
Or:
sudo docker exec -it NGINX_NAME service nginx reload
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.