1

My app runs in a Docker container and I'm using off-line deployment where I

  1. docker save the image on my development machine and bundle it with the app
  2. manually transfer the bundle of tarfile and my app via USB stick
  3. docker load it on the target machine (target is not connected to a network)

Steps 1 & 3 are performed by BASH scripts (Linux).

App updates often do not require an update of the Docker image and since docker save and docker load are both quite slow and resource intensive, I would like to avoid these steps whenever possible.

Is there a way to find out if a tar'ed image equals an image IMAGE:TAG on my Docker daemon?

I have tried skopeo inspect docker-archive:... vs. docker image inspect ... output for comparison but there does not seem to be an image ID to compare. I have seen RootFS layers to be equal but is that a strong guarantee I can skip docker save / docker load?

ΦXocę 웃 Пepeúpa ツ
  • 47,427
  • 17
  • 69
  • 97
Felix L.
  • 11
  • 2

1 Answers1

0

docker until now is not suporting that feature but i solved a similar problem using a bash to "hack it"

what i did:

  1. i saved a docker image e.g. "mymongo:latests" to a tar file, lets call it x.tar

  2. I automatically ran my script and extracted from the tar the file "repositories" 3 that file is actually holding a json like

    {"mymongo":{"latest":"someId"}}

  3. parse that as json because myMongo is the image and latest is the tag

enter image description here

ΦXocę 웃 Пepeúpa ツ
  • 47,427
  • 17
  • 69
  • 97
  • Thanks for sharing your approach but I believe we have a misunderstanding here. I'm not trying to extract the `IMAGE:TAG` information from the `tar` file because those are merely "pointers" and distinct images can be tagged equally at different times/different machines. I need to know if the image contents is truely the same and I therefore can skip `docker save` (developer machine) and/or `docker load` (target machine). – Felix L. Aug 10 '20 at 08:06
  • Hi @FelixL. so you want to compare Images then? – ΦXocę 웃 Пepeúpa ツ Aug 10 '20 at 08:35
  • Yes, and I expect to be able to compare by a sha256:.. hash that is virtually a checksum, instead of comparing the layers contents. As mention in my Q, I have observed RootFS layers to be same, so that's something already. Just not sure if this is enough to compare to conclude equality. Sure an image is made up of all its layers but there might be additional data that I'm not aware of. I was hoping to find something like an overall checksum that I can ultimately conclude equality from. – Felix L. Aug 10 '20 at 10:46
  • why dont just compare the "creation date"??? the newer the winner :) – ΦXocę 웃 Пepeúpa ツ Aug 10 '20 at 11:15