New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull from a docker run should assume latest tag if not specified #5047

Closed
ibuildthecloud opened this Issue Apr 6, 2014 · 11 comments

Comments

Projects
None yet
7 participants
@ibuildthecloud
Contributor

ibuildthecloud commented Apr 6, 2014

Currently if you run docker run -t -i ubuntu bash on a fresh install it will download all tags of the ubuntu template. This causes hundreds of mb to be downloaded as you get 10.04, 12.04 and 13.10. If you run docker run -t -i ubuntu:latest bash only latest is pulled and its about 70mb.

I propose that if you do docker run -t -i ubuntu bash and ubuntu does not exists, the docker cli should assume that you meant ubuntu:latest an only pull the latest tag.

@thaJeztah

This comment has been minimized.

Show comment
Hide comment
@thaJeztah
Member

thaJeztah commented Apr 6, 2014

+1

@ostezer

This comment has been minimized.

Show comment
Hide comment
@ostezer

ostezer Apr 6, 2014

Contributor

Hiya @ibuildthecloud,
Why do you think that Docker should make any assumptions?
Explicit is better than implicit, IMO.

ubuntu here refers to a repository - the one called ubuntu, which happens to contain Ubuntu stuff.

Although I agree that this can be a little bit confusing.
If/since images default to [:latest] tag, however, there must be a reason why the entire repository is pulled.

Contributor

ostezer commented Apr 6, 2014

Hiya @ibuildthecloud,
Why do you think that Docker should make any assumptions?
Explicit is better than implicit, IMO.

ubuntu here refers to a repository - the one called ubuntu, which happens to contain Ubuntu stuff.

Although I agree that this can be a little bit confusing.
If/since images default to [:latest] tag, however, there must be a reason why the entire repository is pulled.

@thaJeztah

This comment has been minimized.

Show comment
Hide comment
@thaJeztah

thaJeztah Apr 6, 2014

Member

@ostezer I agree with you in general (explicit over implicit) however (unless I'm mistaken) docker run ubuntu will effectively run ubuntu:latest. So docker itself already makes the assumption that the latest tag/version should be used. Downloading the whole repository when only a single image is used seems to me like a waste of resources. I added my '+1' for this reason.

If no assumptions should be made (which may be a good thing), Docker should throw a warning e.g. Image name "ubuntu" is ambiguous, please specify a tag to run.

Member

thaJeztah commented Apr 6, 2014

@ostezer I agree with you in general (explicit over implicit) however (unless I'm mistaken) docker run ubuntu will effectively run ubuntu:latest. So docker itself already makes the assumption that the latest tag/version should be used. Downloading the whole repository when only a single image is used seems to me like a waste of resources. I added my '+1' for this reason.

If no assumptions should be made (which may be a good thing), Docker should throw a warning e.g. Image name "ubuntu" is ambiguous, please specify a tag to run.

@SvenDowideit

This comment has been minimized.

Show comment
Hide comment
@SvenDowideit

SvenDowideit Apr 6, 2014

Contributor

+1 - we discussed this somewhere last week (or the one before) - we'd then need something like docker pull debian:* to pull all the images in the repo.

mmm, even weirder - what would you expect Docker to pull when you don't have any ubuntu images and do docker run ubuntu? - it seems that it also pulls everything, not just ubuntu:latest.

Contributor

SvenDowideit commented Apr 6, 2014

+1 - we discussed this somewhere last week (or the one before) - we'd then need something like docker pull debian:* to pull all the images in the repo.

mmm, even weirder - what would you expect Docker to pull when you don't have any ubuntu images and do docker run ubuntu? - it seems that it also pulls everything, not just ubuntu:latest.

@thaJeztah

This comment has been minimized.

Show comment
Hide comment
@thaJeztah

thaJeztah Apr 6, 2014

Member

Otoh, the 'explicit' approach (although breaking backward compatibility) might be a good thing in the longer term.

For example, if I run an example docker run ubuntu [some command] which was written in 2013 and run the same example a year later, a different version of ubuntu will be pulled from the repository, possibly giving a different outcome. Requiring a tag to be specified would circumvent that.

Still, specifying [:latest] will give the same problem, so not sure if anything can be gained by this. Advising people to explicitly specify a version in their Dockerfiles may be a good thing.

Member

thaJeztah commented Apr 6, 2014

Otoh, the 'explicit' approach (although breaking backward compatibility) might be a good thing in the longer term.

For example, if I run an example docker run ubuntu [some command] which was written in 2013 and run the same example a year later, a different version of ubuntu will be pulled from the repository, possibly giving a different outcome. Requiring a tag to be specified would circumvent that.

Still, specifying [:latest] will give the same problem, so not sure if anything can be gained by this. Advising people to explicitly specify a version in their Dockerfiles may be a good thing.

@ostezer

This comment has been minimized.

Show comment
Hide comment
@ostezer

ostezer Apr 6, 2014

Contributor

Here is what I think:

Default behaviour (:latest): For several reasons, all of which can be individually discussed for a length of time, I believe that it is absolutely normal and good that :latest gets pulled as the default. Tags, although very flexible and non-restrictive, look like as if they will become version indicators and it is normal to have the latest one being pulled.

Getting the entire repo: I'm not sure why the entire repo gets pulled when a tag is not explicitly stated. I didn't code or design that part of the product, so I can not comment. However, personally, I agree with @thaJeztah and @ibuildthecloud - why not only pull the relevant layer and for the entirety of the repository, why not require :* as @SvenDowideit suggested?

Kewl ;-)

P.S. From 9 whole months ago #1060 @samalba, @shykes and more.

Contributor

ostezer commented Apr 6, 2014

Here is what I think:

Default behaviour (:latest): For several reasons, all of which can be individually discussed for a length of time, I believe that it is absolutely normal and good that :latest gets pulled as the default. Tags, although very flexible and non-restrictive, look like as if they will become version indicators and it is normal to have the latest one being pulled.

Getting the entire repo: I'm not sure why the entire repo gets pulled when a tag is not explicitly stated. I didn't code or design that part of the product, so I can not comment. However, personally, I agree with @thaJeztah and @ibuildthecloud - why not only pull the relevant layer and for the entirety of the repository, why not require :* as @SvenDowideit suggested?

Kewl ;-)

P.S. From 9 whole months ago #1060 @samalba, @shykes and more.

@thaJeztah

This comment has been minimized.

Show comment
Hide comment
@thaJeztah

thaJeztah Apr 7, 2014

Member

Seems we're all on the same page then :) (fwiw, just a visitor here)

I'm in favor of docker pull debian:* to force a full download of a repo (will need to be documented).

With regard to the 'explicit' approach for using an image; I just wanted to mention that for the maintainers/coders to consider.

Member

thaJeztah commented Apr 7, 2014

Seems we're all on the same page then :) (fwiw, just a visitor here)

I'm in favor of docker pull debian:* to force a full download of a repo (will need to be documented).

With regard to the 'explicit' approach for using an image; I just wanted to mention that for the maintainers/coders to consider.

@ibuildthecloud

This comment has been minimized.

Show comment
Hide comment
@ibuildthecloud

ibuildthecloud Apr 9, 2014

Contributor

I was careful to say that we should assume :latest when the CLI is ran for run. Currently docker pull ubuntu will pull the entire repo. I think that behaviour is correct because you didn't specify a tag so just grab everything. For docker run your only going to run a specific tag, and as @thaJeztah pointed out, docker run already assumes :latest so just pull latests, it's far more efficient.

The reason I want this change is just for very practical reasons. It is fast and simple to not include the :latest and pretty much all docker tutorials don't include it. ATM the norm seems to be that people are not often specifying a tag. I personally want to use tags to properly version my images. But since were talking about binary assets, pulling all tags for the whole history of my image could be huge. It's not like git where you can clone the whole repo because compressed text files don't take up that much space.

Because of the default behaviour of docker run I've held off on really using tags.

Contributor

ibuildthecloud commented Apr 9, 2014

I was careful to say that we should assume :latest when the CLI is ran for run. Currently docker pull ubuntu will pull the entire repo. I think that behaviour is correct because you didn't specify a tag so just grab everything. For docker run your only going to run a specific tag, and as @thaJeztah pointed out, docker run already assumes :latest so just pull latests, it's far more efficient.

The reason I want this change is just for very practical reasons. It is fast and simple to not include the :latest and pretty much all docker tutorials don't include it. ATM the norm seems to be that people are not often specifying a tag. I personally want to use tags to properly version my images. But since were talking about binary assets, pulling all tags for the whole history of my image could be huge. It's not like git where you can clone the whole repo because compressed text files don't take up that much space.

Because of the default behaviour of docker run I've held off on really using tags.

@unclejack unclejack self-assigned this May 12, 2014

@vieux vieux closed this in #5841 May 16, 2014

gerrit-ovirt-org pushed a commit to oVirt/samples-uiplugins that referenced this issue May 19, 2014

Docker plugin - add tag "latest" when tag not specified
When there is no tag specified, the entire docker repo
is downloaded. However only the one tagged as "latest" is ran.
So in order to avoid downloading the entire repo,
if user didn't specify any tag, append "latest" to download
only the image tagged with latest.
See related issue and discussion here
moby/moby#5047

Change-Id: I5e875733797e8fcebd557c35e230dcdb6fb5512e
Signed-off-by: Alissa Bonas <abonas@redhat.com>
@virgo47

This comment has been minimized.

Show comment
Hide comment
@virgo47

virgo47 Jul 8, 2014

+1 for latest. Currently this is counter-intuitive, obviously most people expect to download some sort of "package" (image) and only the newest one (unless otherwise specified) makes sense. I was horrified to find out I downloaded 12 versions of 400MB image when I needed only 1.

virgo47 commented Jul 8, 2014

+1 for latest. Currently this is counter-intuitive, obviously most people expect to download some sort of "package" (image) and only the newest one (unless otherwise specified) makes sense. I was horrified to find out I downloaded 12 versions of 400MB image when I needed only 1.

@voltagex

This comment has been minimized.

Show comment
Hide comment
@voltagex

voltagex Aug 9, 2015

This especially affects users on low-bandwidth/metered connections.

voltagex commented Aug 9, 2015

This especially affects users on low-bandwidth/metered connections.

@thaJeztah

This comment has been minimized.

Show comment
Hide comment
@thaJeztah

thaJeztah Aug 9, 2015

Member

@voltagex this is already implemented in #5841 over a year ago, so not sure what issue you're seeing, but that must be something different?

Member

thaJeztah commented Aug 9, 2015

@voltagex this is already implemented in #5841 over a year ago, so not sure what issue you're seeing, but that must be something different?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment