How to detect updated images

I am working on code to detect when I am running outdated images.

I already have written in a interface into daemon api as well as the v2 registry api. I can pull up the image manifest from the registry and I can examine the image my docker daemon is running.

What I can’t figure out is how I can compare if the two are identical. Given the information about the image+tag I have on my local machine how can I tell if that image+tag has been updated/different on the registry server?

I know many have suggested just doing a pull but I don’t want to risk disturbing/changing production servers. Being able to compare versions with the registry without the risk of making changes allows me to alert on out of date images and plan maintenance windows around them.

I am trying to solve a similar issue. I need to verify that an image running across multiple environments (dev, stage, pilot, prod) is the same. I can’t seem to find a good solution for this anywhere.

I noticed that running this command returns the same value from an images metadata across all environments but I am not sure WHAT this value is, how it gets set, or if it ever changes.

docker inspect --format=’{{.Config.Image}}’

I’m curious to hear if you find out anything.

I came up with an interim solution to my problem. We use Jenkins to build our images so I append a LABEL to the Dockerfile just prior to the build that contains build related meta data such as the git commit hash that triggered the build, the build number etc, etc. Now, using docker inspect will allow me to easily identify whether two images are from the same build even if they have different id’s.

FYI, I am DockerCon 2016 and I was just told this issue will be solved in 1.12. I am told additional information will be visible in the inspect api that will allow interrogating a registry to find out if the image name+tag are the same as the one on the local machine.

Did you get a chance to test the new functionality in Docker 1.12? What command/switches do you have to issue in order to verify the image?