DEV Community

Discussion on: Why Docker? Creating a multi-container application with docker

Collapse
 
tylerlwsmith profile image
Tyler Smith

Thanks for writing this article!

Do you have any advice regarding when to use docker-compose vs when to use a Dockerfile and programmatically install the individual services into one container?

Collapse
 
abiodunjames profile image
Samuel James • Edited

Hi Tyler,
Thanks for reading.

A container is standardized unit of software which is lightweight, standalone while Docker Compose provides a way to orchestrate multiple containers (applications) that work together.
In a real-world, you may need more than one components (application) to run a software. For example: a software may need many components like database, webserver, cache server, and more to run. Each of these components is a unit.
When you have multiple components to deal with, you should use docker-compose to orchestrate them.

Don't package everything into a single container. A container is a unit of software.

Collapse
 
tylerlwsmith profile image
Tyler Smith

"A container is a standardized unit of software."

That's a killer way to describe containers, thank you for your insight! I've been spending the day wrangling with docker-compose and was wondering if I was crazy for not just using a single Dockerfile.