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.
Related
I know Watchtower (https://github.com/v2tec/watchtower), but would like to understand if there is a way that I check for docker image updates without pull (downloading it)
I seems that if I ie. use docker pull pihole:latest it download the image, no matter if it the newest or already on my device.
I would like to get the digest or image id from the docker hub, so I can compare it with my local image id
In 2019, I made a pull image of Python 3.6. After that, I was sure that the image was self-updating (I did not use it actively, I just hoped that the latest pushes themselves were pulled from the repository or something like that), but I was surprised when I accidentally noticed the download/creation date is 2019.
Q: How does image pull work? Are there flags so that the layer hash/its relevance* is checked every time the image is built? Perhaps there is a way to set this check through the docker daemon config file? Or do I have to delete the base image every time to get a new image?
What I want: So that every time I build my images, the base image is checked for the last push (publication of image) in the docker hub repository.
Note: I'm talking about images with an identical tag. Also, I'm not afraid to re-build my images, there is no purpose to preserve them.
Thanks.
You need to explicitly docker pull the image to get updates. For your custom images, there are docker build --pull and docker-compose build --pull options that will pull the base image (though there is not a "pull" option for docker-compose up --build).
Without this, Docker will never check for updates for an image it already has. If your Dockerfile starts FROM python:3.6 and you already have a local image with that name and tag, Docker just uses it without contacting Docker Hub. If you don't have it then Docker will pull it, once, and then you'll have it locally.
The other thing to watch for is that the updates do eventually stop. If you look at the Docker Hub python image page you'll notice that there are no longer rebuilds for Python 3.5. If you pin to a very specific patch version, the automated builds generally only build the latest patch version for each supported minor version; if your image is FROM python:3.6.11 it will never get updates because 3.6.12 is the latest 3.6.x version.
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.
I have the following scenario:
A daemon_pulling running docker pull the last version of an image from a private registry.
E.g. docker pull localhost:5000/myimage:v1 # sha or image id: 1234
A daemon_pushing running docker push of the last version of a image.
E.g. docker commit container_stable localhost:5000/myimage:v1 && docker push localhost:5000/myimage:v1 # sha or image id: 6789
The code works fine to deploy images based on containers!
The problem is when a dameon_pushing (sha or image id: 6789) is running and run a daemon_pulling (sha or image id: 1234) at the same time, because the pushing (6789) is not finished when a docker pull (1234) is used and detect a local change (6789 != 1234) and try download the image (1234) again but my last stable image is pushing (6789)...
I'm looking for a way to push without affect a pull in progress, and vice versa.
What is a better way to manage this concurrency?
I tried using a different Docker image name as pivot and rename it directly on the registry server, but I didn't find a way to rename remotely (just local rename).
It looks like you have set up your CI build to pull an existing image, run a container from it and install the updates, commit the changes to the same image name and then push it back to the registry. Continuously updating images by running containers and committing to the same image is not a good practice, since it hides the changes, and makes it unnecessarily difficult to replicate the build.
A better way would be to build the image from a Dockerfile, where you define all build steps. Look at the Reference Architecture on Docker's official Continuous Integration use case for examples. If you want to shorten build times, you can make your own base image to start from.
I have a Docker image that I'd like to push to Docker Hub:
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
mattthomson/hadoop-java8 0.1 d9926f422c14 11 days ago 857.9 MB
```
I've run docker login, logged in as mattthomson, and run docker push mattthomson/hadoop-java8:0.1. This takes a while, showing a progress bar of the upload.
However, it seems not to have worked. If I run docker pull mattthomson/hadoop-java8:0.1 from another computer, I get "Tag 0.1 not found in repository mattthomson/hadoop-java8". The images doesn't show up here, either.
What am I doing wrong?
I had to confirm my email address so my repositories show up on docker hub. Simple but didn't notice at first.
I experienced this when my Docker Hub organisation had reached its limit on the number of private repositories I was allowed to create (and I also got an email from Docker Hub about reaching this limit).
To solve the problem I upgraded my Docker Hub subscription to allow more repositories.
It would be nice if the error message from Docker Hub contained some hint to the cause.
I retried a number of times before this went through successfully. I was misled by the fact that the upload was failing partway through, without displaying an error message, just a timestamp. The error code was non-zero.