Is Docker Compose suitable for production?

I like the idea of ​​modulating applications in containers (db, fronted, backed ...) However, according to Docker docs, "Compose is great for development, testing, and middleware environments . " The proposal does not say anything about the work environment. So I am confused here.

Is it better to use a Dockerfile to create a production image from scratch and install the entire LAMP stack (etc.)? Or is it better to build a production environment using docker-compose.yml ? Is there any reason (overhead, binding, etc.) that Docker does not explicitly say that Compose is great for production?

+7
docker docker-compose dockerfile
source share
2 answers

Indeed, you need to define “production” in your case.
Compose simply starts and stops several containers with a single command. It does not add anything to the mix, which you could not do with the usual docker commands.

If "production" is the only docker node with all the defined instances and relationships, then compose can do this.
But if you need multiple hosts and dynamic scaling across the cluster, you really look at a swarm or another option.

+8
source share

Just to expand on what was already mentioned in @ChrisSainty, create only an orchestration tool, you can use your own images created using your own Dockerfiles, with your layout settings in one host. But note that a swarm is created against the cluster , as it provides the same API as a single Docker host.

In my opinion, this is an easy way to implement the microservice architecture using containers to adapt services with high performance. In addition to this, I recommend checking out this white paper on best practices for using compose in production environments.

+3
source share

All Articles