Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is Docker Compose suitable for production?

I like the idea of modularizing an applications into containers (db, fronted, backed...) However, according to Docker docs "Compose is great for development, testing, and staging environments". The sentence tells nothing about production environment. Thus, I am confused here.

Is it better to use Dockerfile to build production image from scratch and install all LAMP stack (etc.) there? Or is it better to build production environment with docker-compose.yml? Is there any reason (overhead, linking etc.) that Docker doesn't explicitly say that Compose is great for production?

like image 332
Lukasz Dynowski Avatar asked May 30 '16 08:05

Lukasz Dynowski


People also ask

Is Docker compose good for production?

In Conclusion. Using docker-compose is fine if you are working on a single machine or don't need to distribute containers across multiple inter-connected machines. If you would be alright with just using Docker by itself, you can use docker-compose as well.

What is Docker compose good for?

Docker Compose is great for development, testing, and staging environments, as well as continuous integration workflows.

Can a Docker image be used in production?

In a production environment, Docker makes it easy to create, deploy, and run applications inside of containers. Containers let developers gather applications and all their core necessities and dependencies into a single package that you can turn into a Docker image and replicate.

Is Docker good for production database?

Docker is great for running databases in a development environment! You can even use it for databases of small, non-critical projects which run on a single server. Just make sure to have regular backups (as you should in any case), and you'll be fine.


2 Answers

Really you need to define "production" in your case.
Compose simply starts and stops multiple containers with a single command. It doesn't add anything to the mix you couldn't do with regular docker commands.

If "production" is a single docker host, with all instances and relationships defined, then compose can do that.
But if instead you want multiple hosts and dynamic scaling across the cluster then you are really looking at swarm or another option.

like image 56
Chris Sainty Avatar answered Oct 02 '22 21:10

Chris Sainty


Just to extend what @ChrisSainty already mentioned, compose is just an orchestration tool, you can use your own images built with your own Dockerfiles with your compose settings in a single host. But note that it is possible to compose against a swarm cluster as it exposes the same API as a single Docker host.

In my opinion it is an easy way to implement a microservice architecture using containers to tailor services with high efficient availability. In addition to that I recommend checking this official documentation on good practices on using compose in production environments.

like image 20
Rogério Peixoto Avatar answered Oct 02 '22 20:10

Rogério Peixoto