What is the difference between a docker service and a stack?

I wonder what the difference is between such things. They have almost the same commands and give the same result.

+30
docker-compose docker-swarm
source share
2 answers

docker service used when managing a separate service in a docker service roaming cluster. The client command line gets access to the docker roaming manager.

docker stack can be used to manage a multiservice application. It also moves many of the parameters you enter on docker service to a .yml file (e.g. docker-cloud.yml or docker-compose.yml) for easier reuse. It works as the front end of a β€œscript” on top of the dock-dock manager used by the docker stack clan, so you can do all docker stack with docker service .

And last but not least, you can assume that docker service vs docker stack same as docker run vs docker compose , but in a docker compose socket cluster.

+35
source share

A service defines one or more instances of the same image deployed on one or more computers (described by a single entry in the services section of docker-compose.yaml files).

A stack is a group of heterogeneous services (described by the entire yaml file).

+25
source share

All Articles