spotify/docker-client

docker.pull("imagename") causes docker daemon to pull all known tags of the image

Open

#873 opened on Aug 24, 2017

View on GitHub
 (6 comments) (0 reactions) (0 assignees)Java (1,430 stars) (551 forks)batch import
help wantedpinned

Description

As seen in https://github.com/spotify/docker-client/issues/857#issuecomment-324380422, pulling the name of an image repository without specifying a tag (such as dockerClient.pull("redis")) causes the docker daemon to pull all the tags that it can find of that image.

When dockerClient.pull("redis") is called, the client sends a request to the Docker Remote API like POST /images/create?fromImage=redis.

When no tag parameter is specified for the image pull/create, it seems like the daemon will try to pull all known tags from the repository, which appears to be behavior that isn't quite documented (but then again it is not clear which image should be pulled for this request).

When you do docker pull redis from the command line, the docker-cli sends the request POST /images/create?fromImage=redis&tag=latest - it interprets the tag-less image request as being :latest implicitly, but our DockerClient doesn't do the same.

It would probably make more sense for DefaultDockerClient to quietly interpret an image pull like "redis" as "redis:latest" to behave the same as docker pull, rather than sending POST /images/create?fromImage=redis to pull all known tags.

Contributor guide