What is the difference between docker service and stack?

Dmitry Nalyvaiko picture Dmitry Nalyvaiko · Jun 2, 2017 · Viewed 10.4k times · Source

I am wondering what the difference between such things. They have got almost the same commands and give the same result.

Answer

benjah1 picture benjah1 · Jun 6, 2017

The docker service is used when managing individual service on a docker swarm cluster. It is the client command line to access the docker swarm manager.

The docker stack can be used to manage a multi-service application. It also moves many of the options you would enter on the docker service into the .yml file (such as docker-cloud.yml or docker-compose.yml) for easier reuse. It works as a front end "script" on top of the docker swarm manager used by docker swarm cluster, so you can do everything docker stack does with docker service.

Last but not least, you can consider the docker service vs docker stack is the same as docker run vs docker compose, but in the docker swarm cluster.