devops - Should I use separate Docker containers for my web app? -


do need use separate docker container complex web application or can put required services in 1 container? explain me why should divide app many containers (for example php-fpm container, mysql container, mongo container) when have ability install , launch stuff in 1 container?

something think when working docker how works inside. docker replaces pid 1 command specify in cmd (and entrypoint, more complex) directive in dockerfile. pid 1 init system lives (sysvinit, runit, systemd, whatever). container lives , dies whatever process started there. when process dies, container dies. stdout , stderr for process in container given on host machine when type docker logs mycontainer. incidentally, why need jump through hoops start services , run cronjobs (things done init system). important in understanding motivation doing things way.

now, can whatever want. there many opinions "right" way this, can throw away , want. figure out how run of services in 1 container. know how docker replaces pid 1 whatever command specify in cmd (and entrypoint) in dockerfiles, might think prudent try , keep apps running each in own containers, , let them work each other via container linking. (update -- 27 april 2017: container linking has been deprecated in favor of regular ole container networking, more robust, idea being join separate application containers same network can talk 1 another).

if want little deciding, can tell own experience ends being cleaner , easier maintain when separate apps individual containers , link them together. building wordpress installation hhvm, , installing nginx , hhvm/php-fpm wordpress installation in 1 container, , mariadb stuff in container. in future, let me drop in replacement wordpress installation directly in front of mariadb data no hassle. worth containerize per app. luck!


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -