Menu

Top 6 changes in Docker CE 17.05

On May 5th 2017 the Docker engineering team released version v17.05.0-ce of the Docker CE product. The versioning is relatively new and follows a similar pattern to the Ubuntu project - YY.MM - so the next version will be 17.06 for June. CE stands for Community Edition and differentiates between this and the commercial offering.

Like most well-managed open-source projects a high-level changelog is provided with each release - this lets us know what new features are available and sometimes these link to Pull Requests to give additional context and discussion.

In this post I'll highlight a few of the changes.

Multi-stage builds

The long-awaited multi-stage builds were made available in the 17.05 CE release and also highlighted in the Dockercon keynote. This feature helps you separate your build-time dependencies from your runtime environment. In the case of a small Golang Dockerfile your resulting image could go from around 600MB in size to under 10MB.

--mount flag for docker run

The syntax for mounting volumes in docker run and Swarm is very different and that means learning two sets of syntax. The --mount change means docker run can now use the syntax from docker swarm create.

In this example I'll show the various options for mounting using the Portainer project which provides a free, feature-rich UI for Docker and Swarm.

Dockerfile via stdin

A new change to the user experience means that you can now read a Dockerfile over stdin. I'm not sure this is a change everyone will need in their toolbox but advanced users may make use of it for scripting. It means that rather than reading a Dockerfile from disk - you can read it from the output of another program or the bash console.

Did you know that the -f flag allows you to specify a different name or path for your Dockerfile? This can be useful when maintaining projects for different architectures. You could maintain a Dockerfile for Raspberry Pi called Dockerfile.armhf for instance and then build it on a RPi with docker build -t myimage:pi. -f Dockerfile.armhf.

Secrets get formatting

The CLI has improvements around inspecting and listing secrets created on your swarm.

Setting up the daemon's data root

The --graph flag that can be configured on the Docker daemon to specify the root folder of your Docker library has had a name change. The flag is now called --data-root.

If you're using --graph or -G you don't need to change just yet but if you want to then find your systemd file with systemctl status docker. I'm on Ubuntu here so my file is at: /lib/systemd/system/docker.service.

So we can change the Docker data root from /var/lib/docker if we want to anything else by adding --data-root to our systemd file:

ExecStart=/usr/bin/dockerd -H fd:// --data-root=/mnt/ssd/lib/docker

Task logs for Docker Swarm

You can now fetch the logs for individual tasks or replicas for your Docker Swarm services. An example may be an NGinx webserver: