-
Notifications
You must be signed in to change notification settings - Fork 549
docker.pull("imagename") causes docker daemon to pull all known tags of the image #873
Comments
Might be helpful to tag this issue with "Help Wanted". It could be an easy PR for a new contributor. |
@mattnworb This behavior is documented in recent API versions.
Do we still want to mimic the behavior of the |
It is hard to say what the user intent is if they call What happens if you try to create a container from a tagless image, like |
Seems like this code will run the same image when IMAGE is "nginx" or "nginx:latest". final DockerClient client = DefaultDockerClient.fromEnv().build();
final ContainerConfig config = ContainerConfig.builder()
.image(IMAGE)
.portSpecs()
.build();
final ContainerCreation container = client.createContainer(config);
client.startContainer(container.id());
|
this should maybe be documented in the readme file.
docker pull just hang for me and i was going to submit a bug about it when i found this ticket. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
As seen in #857 (comment), 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 likePOST /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 requestPOST /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 sendingPOST /images/create?fromImage=redis
to pull all known tags.The text was updated successfully, but these errors were encountered: