7

Docker changes so fast so I'm trying to find out if a Docker Swarm (swarm mode) cluster can be upgraded. For instance say I am running 1.12 and I have a 3 node cluster running services. Let's also say Docker 1.13 comes out and I want to upgrade the engines that make up the swarm cluster. Is there anyway to do this that doesn't include recreating the cluster would prefer a almost a rolling engines update?

Thank you!

learner
  • 73
  • 1
  • 3

1 Answers1

16
  1. Drain first node.

    sudo docker node update --availability drain worker2

  2. Verify No containers are on drained node.

    sudo docker ps #on worker2

  3. Upgrade docker engine.
  4. Check node in swarm manager.

    sudo docker node ls

  5. Change availablity to Active.

    sudo docker node update --availability Active

  6. Repeat the steps for other nodes.
Farhad Farahi
  • 35,528
  • 7
  • 73
  • 70
  • 5
    I recommend having at least 3 managers in the swarm, But you can promote other nodes, demote manager then upgrade manage. – Farhad Farahi Jan 04 '17 at 18:50
  • @happyyangyuan: As Farhad said: it's best to have more than one manager. But even if you have just one: your apps will keep running if the manager is offline. You just can't schedule new workloads or change existing ones. So even if you just have one manager node (which you shouldn't), you can upgrade – Frank Louwers Feb 12 '19 at 12:27