Docker NGINX service reload bug

Hello all! I’m new to Docker and, but I’ve loving both already! The folks at Linux Server really have done a great job of documenting their containers and adapting them for all the popular architectures. Thanks for that!

Now, the reason for my post; I’m by no means and programmer or developer, but I think I stumbled across a bug in the nginx docker build. I’ve noticed if I attempt to check config files or reload the nginx service with a docker exec command, I receive the following error:

pi@docker:~ $ docker exec -it reverse-proxy nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: [emerg] open() “/run/nginx/” failed (2: No such file or directory)
nginx: configuration file /etc/nginx/nginx.conf test failed

This is true in both the linuxserver/nginx:latest and linuxserver//letsencrypt containers. I instances of each running on separate servers.

If I connection to a bash shell session and print version information with nginx -V (big V), I get the following output:

pi@docker:~ $ docker exec -it reverse-proxy nginx -V
nginx version: nginx/1.18.0
built with OpenSSL 1.1.1g 21 Apr 2020
TLS SNI support enabled
configure arguments: --prefix=/var/lib/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf --pid-path=/run/nginx/…

This is additional output past the dots, but I removed it for the sake of readability. The interesting bit is that last argument for PID path: --pid-path=/run/nginx/ This is the PID file mentioned in the error above.

If I ls the /run directory on either of the containers in question, I notice this is no nginx directory, AND the file is actually in the root of /run.

I’ve not compiled any docker applications myself, as I lack the skill to do so, and maybe this is not related, but it seemed suspicious, so I thought I would report it here. Hopefully this is the appropriate medium to do so!

Thanks for the taking the time to read my post, and again, thank you for the all the hard work maintaining the site and applications that have considerably eased my introduction to Docker!

It’s not a bug, it’s just set up differently than your standard distro install. With that said, we don’t support users running manual commands inside the container unless we ask you to.

1 Like

@aptalca thanks for the prompt reply! I suspected I could be mistaken, as I new to all of this!

That being said, the commands I’m running in my post are advised in the instructions. Those commands specifically would be:

To check configuration in nginx conf files
docker exec -it nginx -t

To reload nginx after making conf file changes
docker exec -it nginx -s reload

Both of these commands produce the same error mentioned in my post. To work around it, I’ve simply been restarting the container. That does the trick just fine, and maybe that is the intent. Please let me know if I’m mistaken in my recollection of the documentation here.

Can you show us where in our instructions we’ve suggested you use those commands?
Restarting the container is the only way we support you reloading nginx unless we specifically advise you otherwise.

1 Like

@driz, well I’m embarrassed! I just went looking for it, and everywhere I looked the instructions said clearly “restart the container” to apply changes. Doh!

Like I said, this is all very new to me, and I have been reading ALOT of forums and blogs in the interest of getting to know the platform. I must have mixed them up. My apologies for that!

Thanks for taking the time to reply though! Have a great night!

1 Like

no worries at all, i just wanted to make sure we didnt have something we need to edit :stuck_out_tongue:

glad you found the answer. As a side note, if you expand your docker containers and need help, join our discord, it’s much more lively! Have a great night

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.