Docker 1.12

Docker announced yesterday the 1.12-rc2 at DockerCon 2016. A lot of news, the most important for me are:

Orchestration

They did and they are doing a big effort on that. Now on 1.12 docker integrate the orchestration tools. It means that the best way to orchestrate docker, it's docker. No more Service discovery or load balance outside docker ecosystem, witch simplify a lot the orchestration process.

Create a cluster

Require Docker Machine and VirtualBox

  • Set up the master: Having a default boot2docker machine, run docker swarm init to promote the node to swarm master
  • Create one minion: docker-machine create --driver virtualbox minion1
  • Create another minion: docker-machine create --driver virtualbox minion2
Join minions to the cluster:
  • eval $(docker-machine env minion1)
  • docker swarm join $(docker-machine ip default):2377
  • eval $(docker-machine env minion2)
  • docker swarm join $(docker-machine ip default):2377
Wake up the service:
  • eval $(docker-machine env default)
  • docker service create --name=nginx -p 80:80/tcp --replicas=3 nginx:1.9
Scale!
  • docker service scale nginx=5

Run curl $(docker-machine ip default) to see nginx running.

Create another master it's very easy, promote a node:

docker node promote <node-id>

Use demote for downgrade.

Release an existing services:

docker service update nginx --image nginx:1.9.15 --update-parallellism 2 --update-delay 10s

Done!

Things to consider:

  • Images are downloaded and stored on each node, be aware of that, use some GC like: Docker-gc

    • Usage: docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v /etc:/etc spotify/docker-gc

    • Will remove containers stoped more than an hour ago and unnecessary images

Dockerfile

Now you can define the healthcheck of your container:

HEALTHCHECK --interval=5m --timeout=3s --retries 3 CMD curl -f http://localhost:82 || exit 1

More news soon, but after try it. Note that it's a release candidate and can contains bugs like: Wrong Scale counter

But in general, its a good tested candidate, I can't wait!