Downloading the internet with docker pull

NOTE: This is based on testing with Docker 1.2 with fig 1.0.1. Please let me know if it has been fixed.

In my previous post I discussed the FROM instruction inside a Dockerfile and the :latest tag. This highlights a deeper problem with Docker, the :latest tag and it’s use with docker pull. Highlighted in a github issue, docker pull and the FROM instructions have different behaviours. While inside a Dockerfile, FROM will assume :latest where as docker pull will assume you mean everything.

This appeared to be fixed in an accepted pull request:
https://github.com/unclejack/docker/commit/b8e338144e90a6bb76110ab04cc216966640a3f4

However looked at the master branch of the client I cannot see any code to handle the scenario of not including a tag with the docker pull command.
https://github.com/docker/docker/blob/master/pkg/parsers/parsers.go#L68-L77
https://github.com/docker/docker/blob/master/api/client/commands.go#L2079-L2110

As a result, when you enter docker pull node, instead of downloading just the latest version as you generally require you will download every node version available.

Docker Node.js Tags

Surprisingly the Registry itself encourages you to download every tag instead of the latest.

Node.js on Docker Hub

Likewise with fig, a tool to help manage running containers. Without defining a tag it will pull all tags in order to bring up the image.

docker pull redis

This is a very common mistake and it’s easy to see why sometimes it feels like Docker is downloading the entire internet when you only wanted a single version. It’s important to include a tag when pulling a docker image to save you downloading the internet.

One thought on “Downloading the internet with docker pull”

Leave a Reply

Your email address will not be published. Required fields are marked *