Reload Nginx Inside Docker Container

I am using docker for Nginx which is running with multiple virtual hosts. Sometimes I have to reload my updated nginx configurations, but I don’t want restart the container each time. Here is how you can reload your nginx without any downtime and without interrupting any connections.

1. Find your container name

Use docker ps to find your nginx container.

2. Reload Nginx

With docker exec -it {container_name} {command} you can directly access your container and execute commands. In my case the name of the container is nginx-server.

2 thoughts on “Reload Nginx Inside Docker Container”

    1. Thank you!
      This is an easy way to reload the config from within the container.
      Since this was written a while ago, I’m sure there have been many changes that have come about for docker… one such change is that you may be able to reload the config by sending the HUP kill signal to the container, e.g.
      docker kill -s HUP

Leave a Reply

Your email address will not be published. Required fields are marked *