다음을 통해 공유


Docker Swarm with Linux and Windows

As soon as you need to run containers in any form more available or production-ready configuration, you're going to need to have more than one Docker engine host OS/VM/node where the containers can run.  In this post and embeded three-part video series I did with Dongluo Chen from Docker we will address how Docker Swarm helps to solve some challenges you will need to address when running in a more availalable or production-ready configuration, including:

  • Which Docker engine node should I run my next container on?
  • Will the Docker engine node have enough capacity / resources available or proper host OS software installed (i.e. on Windows or Linux) to meet the container's requirements to run?
  • What if I keep adding and removing Docker engine nodes - how will I keep track of them all?
  • How can I make my containerized application be balanced across multiple Docker engine node hosts?
  • If a Docker engine node fails - how will I handle this?

Docker Swarm comes to the rescue! Docker Swarm is a clustering and scheduling tool for Docker containers.  Swarm establishes and manages a cluster of Docker nodes as a single virtual system.  One of the big benefits of Swarm is it allows people to use the native Docker commands they are familiar with to run containers.  It should also be duly noted that Swarm needs to be paired with a separate technology for things like node leader election and discovery to truly be effective.  One such option is Consul but see here for other alternative comparisons.

Docker Swarm is supported in Microsoft Azure and can be deployed easily using these two Azure resource manager deployment templates which already have the highly-available baseline configuration details worked out for you:
1) Using CoreOS as the host OS and Consul
2) Using Azure Container Service with Swarm

Below is Part 1 of the video interview with Docker engineer @Dongluochen walking through how to run the 1st option on Azure.

Link to source video on Channel 9

Now that you have a highly available Swarm Cluster, how might you go about adding a Windows Server 2016 Docker engine host node to be available in the Swarm cluster?  This would enable you to provision Windows-based containers through Swarm.  This is exactly what we cover in this part 2 video with Dongluo:

Link to source video on Channel 9

Did you know that you can have Windows Server 2012 R2 run as host nodes in a Swarm cluster?
If you'd like to learn - watch this Part 3 demonstration of how to create swarm binaries for Windows Server and to join the Windows Server as a part of the Swarm cluster.

For more information:

David Tesar - @dtzar

Comments

  • Anonymous
    July 08, 2016
    I'm trying to follow these tutorials and am stuck at setting up the Windows Server 2016 node. Specifically when I run the docker.exe daemon -H command I get a "not supported by windows" error. I'm using the latest Server 2016 TP (TP5) with containers in Azure so I'm not sure what has changed since TP4 and what I should do to get the daemon command to work.
    • Anonymous
      August 16, 2016
      Tim, the issue is caused by Docker daemon change. In Docker 1.12 Docker binary is split into client and daemon. The command stated in this post/video was before 1.12. In TP5 the 1.12 daemon command doesn't work. C:\Windows\system32>docker.exe daemon -H 192.168.0.5:2375 --cluster-store=consul://10.0.0.4:8500 --cluster-advertise=192.168.0.5:2375 not supported by windowsThe updated command should be: C:\Windows\system32>dockerd.exe -D -H 192.168.0.5:2375 --cluster-store=consul://10.0.0.4:8500 --cluster-advertise=192.168.0.5:2375 time="2016-08-17T00:30:30.081370900Z" level=warning msg="[!] DON'T BIND ON ANY IP ADDRESS WITHOUT setting -tlsverify IF YOU DON'T KNOW WHAT YOU'RE DOING [!]" time="2016-08-17T00:30:30.081370900Z" level=debug msg="Listener created for HTTP on tcp (192.168.0.5:2375)" time="2016-08-17T00:30:30.081370900Z" level=info msg="Windows default isolation mode: process"
  • Anonymous
    August 14, 2016
    same here
    • Anonymous
      August 16, 2016
      See reply below.
  • Anonymous
    August 15, 2016
    TP5 and Windows 10 Anniversary edition both have the docker 1.12* versions installed when you add the "containers" Windows feature which now has swarm built-in. This changes the commands which will be used to complete the same task. https://blog.docker.com/2016/06/docker-1-12-built-in-orchestration/. You can also upgrade TP4 instances to have the newer binaries: https://msdn.microsoft.com/en-us/virtualization/windowscontainers/quick_start/quick_start_windows_server