Create your FREE Codefresh account and start making pipelines fast. Create Account

Webinar: Development Swarm Cluster with Docker Compose V3

4 min read
Docker 1.13 introduced a new version of Compose that simplifies deployment.  In our last webinar, Alexei Ledenev (Cheif Researcher at Codefresh) walked us through the new features in Compose V3 developers can use for deployment.  In case you missed it, we recorded it for you to view on demand.  During the session, you’ll learn how to quickly create a multi-node Swarm cluster on your laptop, (without needing to install and manage additional VMs).

View the webinar on-demand to learn:

  • New deployment features in Docker Compose Version 3
  • How to use new Compose V3 features to deploy apps on a Swarm Cluster
  • Live Demo: How to Deploy on a local development cluster (Powered by Docker for Mac/Windows, Docker Compose V3 and Docker-in-docker)

Link to slides

Highlights of Alexei’s Talk:

Docker 4 Mac/Windows

Docker launched Docker for Mac/ Windows last year to provide native platform capabilities and a uniform experience across all platforms.  Docker for Mac and Windows provides the full Docker development environment out-of-the-box, including the native Docker Client, Docker daemon (running inside a small virtual machine), Docker Notary, and Docker Compose, so you have everything you need.

  • Easy installation and setup of a complete Docker development environment
  • Fast and reliable performance with native macOS virtualization (xhyve for OS X) or  native Windows Hyper V virtualization (for Windows) running a custom minimal Linux distro (Alpine)
  • Seamless volume mounting for code and data, including file change notifications that unlock fast edit-test cycles
  • Excellent network support allows working transparently with VPNs and proxies
  • Multi-CPU Architecture Support: arm, mips, ppc64le and even s390x (Mac only)

Docker Swarm

Docker Swarm mode was introduced about a year ago in Docker 1.12. Before that, it was possible to create a Swarm cluster with some key values but difficult to do. A Swarm is a cluster of Docker machines where you have one or more Swarm masters and multiple worker machines. Ideally, you’d like to link them together to a single cluster and be able to deploy your app on this cluster.

The Old Way

Before Swarm mode, you needed to create proper certificates and keys, install the console discovery service, start the console agent on the each machine, properly set up all the certificates, and launch each node with all the proper parameters to connect in a swarm cluster.  It was possible but was a huge headache.

The New Way

Now you just run Docker Swarm on your master machine, take the token (unique ID), and on the other Docker machine, run the docker swarm join command to pass the token.  And that’s it! It will combine both machines on that cluster.

New Deployment Features

New command with Docker 1.13 that allows us to easily deploy our Docker Compose file called docker stack deploy.

$ docker stack deploy --compose-file docker-compose.yml myapp

The Difference between docker stack deploy and docker-compose up

The Docker client has a built-in parser for the docker-compose.yaml format. It can read the new Docker Compose V3 format including the new deploy section, and deploy what’s described in it.  So you can use your Docker Compose file to deploy a Compose application on a swarm cluster.

The docker-compose CLI is a python based application that also understands docker-compose.yaml version 3. It has its own parser implemented but it totally ignores the deploy section. So it doesn’t know how to deploy a Compose file on a swarm cluster. The main difference between the two is that the docker-compose CLI only sees half of the compose file. So if you need to use it for testing and deployment, use the Docker client.

  • docker client has a built-in docker-compose.yaml v3.x parser
  • docker client reads deploy section to deploy a service on swarm cluster
  • docker-compose CLI tool also has a built-in docker-compose.yaml v3.x parser
  • docker-compose CLI tool ignores deploy section and does not deploy on swarm cluster
  • docker-compose CLI tool works against single Docker host only

Compose v3 `deploy`

Before Compose Version 3 (introduced with Docker 1.13) you could do the same things (create services, networks, and volumes on a swarm cluster using the Docker client. But the biggest update in Docker Compose V3 is the feature of stack deployment with swarm. They introduced a new deploy key under the service node.

  • mode -This allows you to specify how this service is deployed (if it’s global or replicated)
  • replicas
  • placement – constraints- this allows you to define where your service is going or needs to be placed (, engine.labels)
  • update_config -allows you to specify how this update should be executed (parallelism, delay, failure_action, monitor, max_failure_ratio)
  • resources – enables you to limit resources, allocate a CPU quota, memory limit, etc. (cpu_shares, cpu_quota, cpuset, mem_limit, memswap_limit, mem_swappiness)
  • restart_policy -what to do if service fails- condition, delay, max_attempts, window
  • labels – can specify labels for each service


(See demo – 19 minutes 05 seconds of the webinar)

In the demo, Alexei showed us how to can create a Docker swarm cluster on a single machine. The demo app he deployed on swarm cluster can be found here:

We encourage you to go and clone it to try by yourself!

Additional Resources

Dan Garfield

Dan is the Co-Founder and Chief Open Source Officer at Codefresh. His work in open source includes being an Argo Maintainer, and co-chair of the GitOps Working Group. As a technology leader with a background in full-stack engineering, evangelism, and communications, he led Codefresh's go-to-market strategy and now leads open source strategy. You can follow him at

Leave a Reply

* All fields are required. Your email address will not be published.