What CLI commands do I need to use in order to check if the image in my private docker registry is a newer version than the one currently running on my server?
E.g. I have a container that I ran using docker run -d my.domain.com:5000/project1
and I would like to know if it is out-of-date.
You can use a bash script running in a
cron
scheduled task:I don't know if this works as advertised. Just a quick hack I just put together. But this will at least give you a little push on how this might be done.
Example output:
AFAIK, this is not possible right now.
The only thing I see would be to pull the registry to check if there is a new version of your image (would then have a different ID than your locally stored image):
But yes, that would mean fetching the new images (if any).
If you have a look at the registry API documentation, you'll see that if you don't mind scripting a bit, you could get this information without actually downloading the image, by fetching the image tags and check if the returned ID for the tag matches the ID of the local image you have with the same tag.
That being said, having something to "check for updates" integrated into the
docker
CLI would be a nice addition.Even when there is no command, you can use the API to check for tags on the registry and compare against what you are running.
By comparing the ids, you can know that you are not running the latest version.
Brownie points to @mbarthelemy and @amuino who put me on track. From that I was able to come up with the following bash script that others may find useful. It just checks if the tag on the registry is different from the currently executing container.
Not sure about the
version
but if you mean thetag
of image, it can be easily checked through the registry v2 api . Note that in context of docker images tag has nothing to do with the version of software.Use curl command in CLI
To get a list of repositories pushed on the private registry, use