You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Koehler, Martin" <ma...@desy.de> on 2021/04/12 07:49:37 UTC

[users@httpd] Use of "exec" in apachectl in a Docker environment

Dear All,
For setting up a webserver in a small docker container it is good practice to run the server in the foreground via "exec"
See E.g. https://github.com/docker-library/httpd/blob/master/2.4/httpd-foreground
This ensures that the apache binary gets PID 1 and signals are propagated (and I think zombies are reaped).

However sometimes it would be nice to use the apachectl script for this, since it loads environment variables, ...
Currently does not work, since inside apachectl the actual apache programm is called without "exec". The result is that the apachectl script remains with PID 1 and e.g. signals (like USR1) for the container get not propagated correctly to the apache process.
If one patches the apachectl so that all calls to the apache binary are done with "exec", everthing works as expected.
(e.g. for debian `sed -i 's/\($HTTPD ${APACHE_ARGUMENTS}\)/exec \1/' /usr/sbin/apache2ctl` )
Might it be a sensible change in the apachectl to always call the binary with "exec" (at least on the systems where exec exists)
Thanks
 Best
 Martin

------------------------------------------------------------------------ 
Dr. Martin Köhler 
Head of library and documentation 
                        Deutsches Elektronen-Synchrotron - DESY 
Building 01d Room O1.443 
phone:  +49-40-8998-1814                                   Notkestr. 85 
fax:    +49-40-8994-1814                                   22607 Hamburg 
e-mail: Martin.Koehler@desy.de                             Germany 
------------------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org