docker-library / nginx

DEPRECATED; image taken over by NGINX upstream

Home Page:https://github.com/nginxinc/docker-nginx

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nginx process not receiving SIGHUP

ToBeReplaced opened this issue · comments

I tried to restart a running container whose config had changed with:
docker kill -s HUP <container>

However, this event does not turn up in:
docker logs <container>

And, the config was not applied to new requests.

How can I send "reload" to a running nginx container?

How are you changing the config file in the running container? What does your docker run look like?

I did some tests with a volume mounted file and was able to change the 404 page or the port by editing the nginx.conf and then running docker kill -s 1 <container>. There was no indication in the output that nginx had reloaded (I was running it with docker run -it --rm -v dir:dir nginx to watch the std out/err).

Mine's a little complicated:

docker run -d --name=<name> -v my_nginx.conf:/etc/nginx.conf -v my.crt:/etc/my.crt -v my.key:/etc/my.key -v html:/usr/local/nginx/html --link=some-container:other-container --expose=443 -p 80 -p 443 nginx:1.7.1

I disabled SELinux and the problem persisted.

Do you observe the changes when running with the container detached (without -it)?

I think I found the problem. I was mounting a directory with -v and you are mounting just a file. I tested doing -v with just the file and when I change the file on the host machine it does not reflect in the container (docker cp ng:/etc/nginx.conf ./nginx2.conf, then diff). This may be the limitation of -v with a file rather than a folder.

This sounds like a case of moby/moby#6011

Oh, that's interesting. Thanks for tracking that down! I'm sure I'm doing similar things in other places as well.