3

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/httpd.pid 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.

1 Answer 1

2

So, via trial and error I've found a way to apparently solve this problem but I'm entirely lost on why this happens.

I've added at the beginnig of the script run by CMD an instruction to delete the contents of /run/httpd:

1 #!/bin/bash
2
3 rm -rf /run/httpd/*
4
5 [... continue execution as before ...]

There seems to be no drawback from this measure, so I'll stick to it.

I'll still be more than happy if anyone can provide an explanation of this behavior.

Kind regards

1
  • wow, I can't set my answer as a solution to my problem... didn't see that one coming...
    – Juanma
    Jan 5, 2018 at 12:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.