I use Docker 17.04.0-ce on Ubuntu 16.04.
Some month ago I pulled the docker image »busybox« using »docker pull busybox«. By default docker will use the »latest« tag for this.
When I list all available images it will list this image with a tag and ID:
> docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
busybox latest 7968321274dc 3 months ago 1.11MB
As far as I know the tag »latest« may be treated the same as »master« in Git. So I would like to know: did something change since I pulled this image the last time? Is my local »latest« version up to date with the »latest« version on Docker Hub?
To use the git comparison again: Git would tell me that my local branch is behind the remote branch by »x« commits.
I tried docker search busybox, but this does not show any information like tags or creation date.
Question 1: How do I find out about newer docker images via commandline?
Question 2: How can I list all tags of an repository via commandline?
PS: On Docker Hub I can see all tags of the »busybox« repo and that the »latest« tag was updated/created „1 month ago“: https://hub.docker.com/r/library/busybox/tags/
Tag Name Compressed Size Last Updated
latest 678 KB a month ago
So there indeed is a difference to my local image, which was created „3 months ago“. The only way to tell the difference seems to be the date however.
Related
Is there a way to check if docker-compose is running the latest version of an image? I know that I can run docker-compose pull to get the latest version, but what happens if I run the pull command and docker-compose already has the newest image? Does the pull request count against my Docker Hub pull request limit?
My end goal is to check for a new image every 24 hours without using Watchtower.
When you do a docker pull against the ":latest" tag of an image, docker will only pull that image if this version of the image is not on your local repository/computer. Works lit git pull, basically. Docker-compose does a simple, classic docker pull, so same mechanic.
You can find a way to find your docker pull limit rate, and your number of remaining pulls in at this link
You can try consulting your remaining pulls, then lauching docker pull <some image>:latest, consulting your remaining pulls again (it'll show the same -1) and doing the same pull again. Pull checks the image version, does not detect changes, does not pull, your remaining pulls number stay the same.
Anyway, you get 100 pulls/6 hours if you are an anonymous user and 200 pulls/6 hours if you are an authentified user. For your use case, you would be okay even if you were pulling the image every day.
I have a client-web/base image I build using gitlab ci pipeline:
latest c4fba30df 204.03 MiB 6 days ago
version_2 c4fba30df 204.03 MiB 6 days ago
version_1 7904a77c0 153.69 MiB 2 months ago
these are the images in my docker repository: as you can see, the image with tag latest, is actually the latest image, having the same image id (c4fba30df) as the image with tag version_2.
I build another image that is built on top of base image:
FROM gitlab.faccousa.net:4567/faccos/client-web/base:latest
...
...
...
Yesterday, I built the above image file and it looks like it happened the following:
Step 1/6 : FROM gitlab.faccousa.net:4567/faccos/client-web/base:latest
---> 7904a77c0
But 7904a77c0 is the version_1, so the older image id.
Am I doing something wrong with the latest tag?
I know latest is misused by many people, but in this case I feel I have a CI the always builds my base image and tags it twice with:
actual tag
latest tag
When you docker run an image, or if a Dockerfile is built FROM an image, and Docker thinks it already has the image locally, it will use the image it already has. In your case, since you already have a ...:latest version, Docker just uses it; it doesn't ever check that there might be a different version of the image with the same tag elsewhere.
The most reliable approach to this is to never use the :latest tag anywhere:
FROM gitlab.faccousa.net:4567/faccos/client-web/base:version_2
If you have a lot of dependent images and the base image changes at all regularly, though, maintaining this can become a hassle.
Another option is to tell docker build to try to --pull the base image every time
docker build --pull -t ... .
with the downsides that this build will fail if the remote repository is unavailable, and builds will take somewhat longer even if the base image hasn't changed.
does base is your project name?
gitlab.example.com:port/user/projectname:latest
here's the full guide
its normal that your version_2 and latest have the same image id
Is there a way to get the tag/version of a Docker image that has been pulled weeks back using the latest tag?
A couple of months back I pulled gitlab/gitlab-ce:latest and there were new versions on Docker Hub meanwhile. I would like to know what exact version I pulled. It could for instance be the version 10.3.9-ce.0. The current tag of latest points to 10.7.3-ce.0 though.
Is it possible to find out the pulled tag/version?
I already tried to use docker inspect gitlab/gitlab-ce, but the only information I could find was RepoTags pointing to gitlab/gitlab-ce:latest. Though there doesn't seem to be a specific version.
For instance, there is one repository created using
$ docker tag friendlyhello john/get-started:part1
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
friendlyhello latest d9e555c53008 3 minutes ago 195MB
john/get-started part1 d9e555c53008 3 minutes ago 195MB
Now here are two images: friendlyhello:latest and john/get-started:part1.
I noticed that these two images has the same IMAGE ID.
So I guess there is just ONE image file on my disk.
If it is true, why should I tag to the repository just like create a link file in operating system?
In short, tags are used for convenience in order to identify an image (which is a combination of filesystem layers). Because your image evolves over time and sees more layers being added to form a new image, tags are also a convenient way to do versioning.
When a user downloads your image from a registry like Docker Hub or the Google Container Registry, they can easily associate which version they are downloading from the tag.
It is no different than tagging a release with git if you are familiar with it but you are tracking changes to your image in this case. You tag a release for your image and push changes to your remote repository.
Taking Ubuntu as an example, tags are used to refer to specific releases of the operating system and there can be plenty. For example these are all valid tags for Ubuntu (see docker hub's page):
rolling
zesty
17.04
latest
xenial
16.04
trusty
14.04
Multiple tags can point to one container image. With Ubuntu: xenial, latest and 16.04 are tags that point to the same location, these are just many ways to refer to the same image. This way and because I know that the latest (stable) version of Ubuntu is xenial and the version number is 16.04, I can download this specific image from the Docker Hub using either of these terms or tags.
In the same way trusty and xenial do not point to the same image. They point to images that may have common filesystem layers but diverged at some point.
You can tag images to make sure you will be able to find them later. If you store an image only with latest its probable you'll overwrite it on the next build and then potentially delete it with docker prune which deletes all images that are not referenced.a
I was using centos image from https://registry.hub.docker.com/u/blalor/centos/
For some reason Blalor decided to remove passwd from the list of packages installed on the base image and my dockers stopped working on new deployments. Why does not docker know the build which was used for my dockers? I have had to change my base images now and change every server's docker image.
I could not use the tag feature because there is the tagging for the blalor's images? Do I have to use the source code and host the centos image myself so that it does not change again?
You do not need to use sources. If you have a working image, you can do docker history <your image> to see the image ID that was used and tag the proper one into shortfellow/centos. If you do not have a working image, on the link you provided, there is a build detail section with the history of build. You can see that on January 13th, 2014, it has been built and the image then was a531daec9f98. You can do FROM a531daec9f98 on your dockerfile to make sure it will never change or you can docker tag a531daec9f98 shortfellow/centos (you will need to docker pull a531daec9f98 before).
It is very similar to git in a sense that if you are using someone's repository, and if that someone does not use tags or branches, when he updates his reposiroty and you re pull, you will have the latest version with the new changes. In order to get back to the version you liked, you need to find the commit id. The solution would be to fork the repository. Which you can do on Docker by tagging the image under you username and pushing to a registry (docker push username/image)