nginxinc/docker-nginx-amplify

Unable reload NGINX use docker kill -s HUP

Closed this issue · 1 comments

Hi,

how do you reload configuration in this container?

I try:
docker kill -s HUP <container-name>
docker exec <container-name> nginx -s reload

>docker exec <container-name> bash
container-shell>kill -1 `cat /run/nginx.pid`

But any not reload configuration

This is a known issue with how this demonstration container handles (or rather doesn't) multiple processes inside the container which is in turn a known issue with how NGINX Amplify agent deals with NGINX services.

Running something like nginx -s reload inside of a running demonstration container should gracefully reload the NGINX service.

docker-nginx-amplify (master u=)> docker run --name amplify-agent -e API_KEY='<REDACTED>' -e AMPLIFY_IMAGENAME=nginx-amplify-issue7 -d nginx-amplify
0250fb9745e566327121a89513f394714791e5253beac55242413a9ca13a8822
docker-nginx-amplify (master u=)> docker exec -ti amplify-agent /bin/bash -l

I see in my NGINX Amplify account a static analysis report suggesting that I should set my worker_processes to auto. So I do that from inside the container and reload the nginx process.

root@0250fb9745e5:/# sed -i.bkp -e 's/worker_processes.*/worker_processes  auto;/' /etc/nginx/nginx.conf
root@0250fb9745e5:/# grep worker /etc/nginx/nginx.conf
worker_processes  auto;
    worker_connections  1024;
root@0250fb9745e5:/# nginx -s reload

Within a minute or whenever the agent checks next, I see this report has been resolved.