3 ms·
Hey Andrew, you can definitely run Apache+php as a docker container. Apache can run in the foreground with "httpd -D FOREGROUND", so that docker can monitor it.
by shykes 13y ago
Hey Andrew, you can definitely run Apache+php as a docker container. Apache can run in the foreground with "httpd -D FOREGROUND", so that docker can monitor it. Then add a few layers to your Dockerfile with php, mod_php, 3d party php packes and your own code - you should be ready to go.
Having docker monitor a foreground process has many advantages over the traditional "init script + self-daemonize" approach. Mostly it avoids reinventing the wheel. For example each process doesn't have to worry about logging, service registration/discovery, etc.
I would argue it is closer to the Unix way :)
- sneak 13y agoIt also has the added advantage of stopping (and presumably automatically restarting, or at least triggering an alarm) a container when the service dies, something a daemonized version with a "while true; sleep" one would not. This is something baked into the design of djb's daemontools (as well as later efforts in that realm like launchd and upstart), something the traditional shell-script startup stuff always got wrong. Failure detection is your friend.
- andrewmunsell 13y agoYeah, I guess that makes sense. Thanks for the response!