Reputation: 63
I have two the same machines
Amazon Linux AMI release 2016.09
in which I have same version of Docker
Docker version 1.12.6, build 7392c3b/1.12.6
I run docker save on one machine and docker import on another. Also I checked sha256sum on both machines.
And after I executing some kind of this command
docker run --name my_name --rm=true -v /my_volume:my_volume image_name /bin/bash
on one machine I get an error
container_linux.go:247: starting container process caused "exec: \"/bin/bash\": stat /bin/bash: no such file or directory"
I have only one hook. Size of container after import differs from original one.
Upvotes: 2
Views: 244
Reputation: 36733
Here is a notable difference, from what you said:
I run docker save on one machine and docker import on another
Don't import
the image, load
it:
docker load < imagefile.tar
If you import
instead, the image is imported without any metadata (WORKDIR, CMD, etc).
docker save
versus docker export
Explanation of the tricky concept:
docker export <container-id>
: Export a container’s filesystem as a tar archive.
Therefore, docker import
will just import the filesystem information as a new image, without any CMD, WORKDIR, etc.
docker save
: Save one or more images to a tar archive.
Therefore, docker load
will restore the complete image (filesystem + metadata as CMD, WORKDIR, etc)
The weird part is that you are able to mix and mess with them: save & import, and export & load.
So always: save & load; or export & import
Upvotes: 1