Describing Our App to Swarm

Learn how we can communicate with Swarm.

We'll cover the following

You’re probably becoming pretty comfortable describing our app as a set of services defined in a Compose file. However, a docker-compose.yml file is development-focused: it lets us rebuild images easily and not get bogged down by unnecessary details such as deployment configuration.

Stack file

However, now when we come to deployment, we need something that is deployment-focused. Swarm introduces the concept of a stack to mean an application made up of a group of services that are capable of being deployed. We describe our stack to Swarm with a deployment-focused variant of a Compose file known as a stack file. Although sometimes it is referred to as a Compose file. We will stick with the stack file since it clearly distinguishes it from a normal Compose file.

Modifying docker-stack.yml

The file docker-stack.yml will be similar to docker-compose.yml but with few modifications as follows:

Get hands-on with 1200+ tech skills courses.