Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker-compose.yml vs docker-stack.yml what difference?

I am new docker-user. And in difference manuals I have find usually docker-compose.yml file for description docker job, but on docker site for this goal used docker-stack.yml file. What difference?

like image 340
Oleksii Sytar Avatar asked Apr 06 '17 08:04

Oleksii Sytar


People also ask

What is docker stack yml?

This is a YAML file written in a domain-specific language to specify Docker services, containers and networks. Given a compose file, it is as simple as one command to deploy the stack across an entire swarm of Docker nodes.

What is stack yml?

Learn more about stacks for Docker Cloud here. A stack file is a file in YAML format that defines one or more services, similar to a docker-compose. yml file for Docker Compose but with a few extensions. The default name for this file is docker-cloud.

What is the difference between Docker compose yml and Dockerfile?

The Dockerfile is used to build images while the docker-compose. yaml file is used to run images. The Dockerfile uses the docker build command, while the docker-compose. yaml file uses the docker-compose up command.

What is the difference between Docker compose and docker Swarm?

The difference between Docker Swarm and Docker Compose is that Compose is used for configuring multiple containers in the same host. Docker Swarm is different in that it is a container orchestration tool. This means that Docker Swarm lets you connect containers to multiple hosts similar to Kubernetes.


2 Answers

docker-compose.yml is for the docker-compose tool which is for multi container docker applications on a single docker engine.

its called with

docker-compose up

docker-stack.yml is for the docker swarm tool. (for orchestration and scheduling).

its called with

docker stack
like image 129
Gabbax0r Avatar answered Sep 21 '22 08:09

Gabbax0r


To add to Gabbax0r reply:

Docker Swarm was a standalone component used to cluster Docker engines as a single one.

As of Docker 1.12 the "Swarm" standalone was integrated inside the Docker engine (read the preamble at this page), and Swarm is (or will be) legacy.

To reply to your original question, it is just different names for different cases, but they both are meant to serve the same purpose.

To reply to your comment question, use docker-compose when you have to orchestrate a multi-container app on a single node; if you have to worry about multi-nodes and load-balancing and all this advanced stuff, you better off go with the Swarm.

like image 32
linuxbandit Avatar answered Sep 22 '22 08:09

linuxbandit