Docker save or import - losing labels and entrypoints

Hi,
I’m trying to prepare a docker image to install on another machine, so thought that the following would work:

docker save -o filename.tar image1:version

Then copied the filename.tar to the other machine and executed the following:

docker import filename.tar image1:version

However when I ran the following after the import:

docker inspect image1:version

That it had lost all the meta data, such labels and entrypoints… :frowning:
If this is not the expected behavior, what is that I’m missing?

If this is the expected behavior, then I noticed that the docker import has an -c option to Apply Dockerfile instructions to the create image however can see a way of extracting the Dockerfile instructions from an existing image. Any ideas?

Thanks

Are you looking for docker load? (I think you created a container, not an image, and I’m a little bit surprised it worked.)

Ok,
So think I have misread the docs :frowning:

Looks like if you do an docker import, it flattens all the layers… So also removes all the of the following:

  • ENV
  • ENTRYPOINT
  • LABEL
  • VOLUME

Even after using docker import -c to put these, it would appear that the ContainerConfig elements when running the inspect are not set.

However after reading the documentation again, docker load does not flatten the images. Thus maintains all the configuration :slight_smile:
But it doesn’t allow you to change the image name, but I suppose I can do this prior to saving the image to disk.

Thanks for the reply… Yes, I just worked it out :slight_smile: