Cli: [Proposal] docker image is up-to-date command

Created on 28 Jun 2019  路  5Comments  路  Source: docker/cli

Spinning this out of #538, one of the requests was to have return codes for docker pull such that a user could determine whether the image _was already_ up-to-date (and nothing was done) or the image was outdated, and docker pull did work and updated the image.

I would argue that an end-user would want a successful return code in each of these instances (and that docker pull should return 0 in both cases), _however_ the functionality is still useful to be able to determine if you have the latest image.

One suggestion:

If your goal is to "watch" for new image versions, you should use API to check for changes.

However, it would be much nicer if there were a command-line argument to be able to do this for me, eg docker isuptodate my/image:latest

aredistribution

Most helpful comment

Sure, I care literally not at all about the _date_ of a thing. What I want to know is: would docker pull do work or not. Apologies if that was unclear.

All 5 comments

This can't really be done.
There is nothing that says that one image is newer than another.
As a registry consumer you could implement this by convention, such as making your tags semver, for example. But it doesn't really make sense in the cli itself.

Sure, I care literally not at all about the _date_ of a thing. What I want to know is: would docker pull do work or not. Apologies if that was unclear.

Every software system that can be employed to perform potentially time-consuming operations in an automated workflow, should provide an interface that allows, for every potentially time-consuming operation, to determine whether the operation would be effectively a time-consuming no-op if executed. Not designing this capability into Docker from the very beginning is a serious design flaw.

This is equally relevant to docker build.

++ to this feature request, it would help for automations

As background for this, if a docker pull updates an image (where a tag that is reuse which is probably part of the issue), this also means there is now an orphaned image left behind wasting disk space on the docker host...

So one can either indiscriminately delete all orphaned images after that message (docker rmi $(docker images -f dangling=true -q)) or do it selectively by getting the image id before the pull

Was this page helpful?
0 / 5 - 0 ratings