Docker Community Forums

Share and learn in the Docker community.

Single process question on "what is docker" pages

All pages I see Docker X LXC says that Dockers “way” is single process container “One Apache, One PHP, One DB”. But I can use Docker With all those on the same container.
When I first read it mislead the way that I could use Docker. Why make so a strong point on something that is more a philosophy than a technical restriction?

This is somewhat a carryover from the PaaS heritage of dotcloud, etc. (“Execute the app as one or more stateless processes”) – It should be more like “one concern per container” than “one process per container”. Indeed, Apache might spawn multiple processes, etc., but should only be concerned with serving some specific thing instead of having a tangle of configuration. In fact now Docker containers can even run their own init process using --init flag for docker run.

Generally, each container should do as little as possible, but no less. So if you have a PHP app, you might have one container for nginx/php_fm (the actual app), which connects to another container running a database, and also a third container running a cache like Redis. This might seem overkill until you consider that using abstractions such as swarm mode you can actually roll out updates, scale, etc. one service / container with minimal disruption to the others, similar to how well separated codebases can be updated more quickly and cleanly.