Keeping your Cluster Clean – new features in Docker 1.13

On 13th January the official Docker blog announced the release of Docker 1.13 which includes a few much needed improvements; my favourite being the new clean-up commands.

Clean-up commands

Did you ever get into a position where your VM filled to the brim with shipwrecked containers and dangling images? I had ended up relying on a small gist I had written a while back to periodically clean up not only my personal machine but cluster machines in test & production environments.

The team at Docker have released two new CLI commands which help you deal with this:

> 'docker system df'

This command allows you to see how much of your machine is clogged up with docker containers and images. This is really usesful to see if it is actually your left over docker deployments which are causing your storage issues.

> 'docker system prune'

This command allows you to remove all your unused stopped containers, volumes, networks and dangling images. You can also run the prune command on specified data types:

Prune can also be used to clean up just some types of data. For example: 'docker volume prune' removes unused volumes only.


Running this on my laptop gave me back 21.81GB of storage!

You can imagine how this will help with keeping your VMs clean, especially those in production. You might want to run this separately from your build pipeline however as you might lose your super snappy rollback if you clean up redundant images on which your previous deployment relies. Nevertheless this will save us all a lot of headaches when machines inevitably clog up with old images, volumes and containers.

At the time of writing AWS EC2 Container Service supports up to v1.12.6 on its ECS optimised AMIs. I suspect Amazon won't be too far behind.

In other cloud-based news the announcement stated that Docker for AWS and Azure is no longer in beta which is a great milestone for Docker and for those of you who may have been waiting for the "Production Ready" green light.

Other Features

There are several more new features in this release which you can read more about on the official docker blog.

  • Using compose-files to deploy swarm mode services
  • A restructured CLI
  • Monitoring improvements
  • Build improvements

Let us know what you think about the new features, tweet us @redbadgerteam.