Container restart misses /run until I exec bash

by Juan Clavero   Last Updated January 05, 2018 10:00 AM

I'm having a weird error on a custom docker image. The host system is centos 7.4 with Docker 17.12.0-ce while the image is based on centos 7.2 with apache and has a custom app running on cgi. When a new container is created it works OK but, when the container is restarted (either from the restart=always flag or manually), it keeps restarting the apache bin at the end of the script run by CMD.

Looking at the apache logs (which are in a volume), it shows these lines with every apache restart:

[auth_digest:error] [pid 19] (17)File exists: AH01762: Failed to create shared memory segment on file /run/httpd/authdigest_shm.19
[auth_digest:error] [pid 19] (17)File exists: AH01760: failed to initialize shm - all nonce-count checking, one-time nonces, and MD5-sess algorithm disabled
[:emerg] [pid 19] AH00020: Configuration Failed, exiting

Googling the error codes, it seems like a problem with /run/httpd folder so I decide to exec a bash terminal to see if there's any problem with it and, at the precise moment I bash into the container, the errors stop, I get these lines:

[auth_digest:notice] [pid 34] AH01757: generating secret for digest authentication ...
[lbmethod_heartbeat:notice] [pid 34] AH02282: No slotmem from mod_heartmonitor
[core:warn] [pid 34] AH00098: pid file /run/httpd/ overwritten -- Unclean shutdown of previous Apache run?
[mpm_prefork:notice] [pid 34] AH00163: Apache/2.4.6 (CentOS) mod_perl/2.0.10 Perl/v5.16.3 configured -- resuming normal operations
[core:notice] [pid 34] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'

and apache starts answering as nothing happened.

I've tested this behavior several times, it's not time-dependant (it can be 5 minutes or 1 hour with the error messages, they will stop as soon as I log in).

So, my questions are:

  1. What can my bash login trigger that solve the problem?
  2. How can I replicate it in the script run by CMD?

Kind regards.

PS: sorry if this has been asked before, I've been having a really difficult time searching for a problem with docker and "/run" as google ignores the slash.

Related Questions

Docker daemon can't starting after system reboot

Updated September 23, 2015 12:00 PM