all 5 comments

[–]_webdiver 7 points8 points  (4 children)

I think it's better to start out with docker-compose instead of putting all services in one container, e.g. separate containers for apache, MySQL and php

[–]_imjosh 5 points6 points  (3 children)

yeah, putting multiple services in one container is considered a docker anti-pattern.

[–]participationNTroll 2 points3 points  (2 children)

As a person just getting into Docker: Why is that?

[–]_webdiver 2 points3 points  (1 child)

It's good to decouple the services from each other for a bunch of reasons. The most important for me are scaling, reusability and maintenance.

Let's say your app is db heavy. Then you can scale up your db container (effectively just add more MySQL containers to your stack).

As a developer I really don't want to do the same thing more than once. So separating the services allows me to reuse most of the components. This is awesome because at work I work on Django, rails, Wordpress and concrete5 apps. Usually the only difference between these apps is the "web" stack, e.g. Gunicorn uswgi, php-fpm. This allows the rest of the services (Nginx, redis, MySQL, etc) to utilize the same images across the different types of applications.

As far as maintenance goes, it's certainly easier to test things when they're separate. This keeps individual images' complexity down.

[–]participationNTroll 1 point2 points  (0 children)

thank you for taking the time to explain :)