🎏 Easy Docker 1.13 Swarm mode Stack

Last time we try an example from Docker official doc and it work pretty well so let’s try some more!

This time we’ll try more example from great Docker Captain. Viktor Farcic

I do buy his book and it super awesome! I recommend you to buy it too!

Now back to our story, Just like usual I modify some script there to make it run all at once (Yes I’m lazy!).

Prerequisites

  • Docker 1.13
  • Docker Compose 1.10
  • Docker Machine 0.9

Upstream

curl -o swarm-cluster.sh https://raw.githubusercontent.com/vfarcic/docker-flow-proxy/master/scripts/swarm-cluster.sh

Swarm Cluster Setup

Will create 3 nodes, This taking sometime, go make some coffee ☕️.

. swarm-cluster.sh

To Creating Swarm Services Through Docker Stack Commands.

. setup-stack.sh

It’s open source here, Do star ⭐ if you like.

PS : If you get “503 Service Unavailable” do wait a minute and try curl again, and if it still no go do try this command.

docker-machine ssh node-1 "docker stack ps go-demo"

And if you seeing below results…you’re doom!

OMG I don’t now what I’m doing

Workaround is just wait for it, in my case it took around 1 hour later then curl I try again and it just work! Let’s check what causing this…

$ docker-machine ssh node-1 'docker ps -a --format "table {{.ID}}\t{{.Status}}"'

Pick one of it ID and run

docker-machine ssh node-1 'docker logs a2e9902f6d80'

And you should see

Panic!

I’ve no idea what causing this yet, so please file issue to Docker if you get this panic issue too (I’m not file yet cause I think it’s only me has this).

To cleanup

docker-machine rm -f node-1 node-2 node-3

Next stop? How about try deploy it on DigitalOcean ? Try beat me on that and show me what you got ;)

Enjoy Stacking Swarm! 💚

Note (ref)

Don’t miss a chance to get free $10 for DigitalOcean ← 2 months free hosting!
And do claim your cheapest .io name before it’s gone at NameCheap.