How do I use Docker save to backup a local image t

2019-05-31 09:15发布

问题:

I want to backup my docker image, named tt, so I can change the base device size from 10 GB to 15 GB.

To do this I want to backup my local image first. But I am getting an error

$ sudo docker save -o tt.tar.gz tt
Error response from daemon: could not verify layer data for: sha256:xxxxx. This may be because internal files in the layer store were modified. Re-pulling or rebuilding this image may resolve the issue

My images:

$ sudo docker images
REPOSITORY                     TAG                 IMAGE ID            CREATED             SIZE
tt                             latest              ced69d804781        13 minutes ago      9.186 GB
quay.io/travisci/travis-ruby   latest              e41062702ee0        2 years ago         5.782 GB

My containers:

$ sudo docker ps
CONTAINER ID        IMAGE                          COMMAND             CREATED             STATUS              PORTS               NAMES
f6ce7cf223b3        quay.io/travisci/travis-ruby   "/bin/bash"         37 hours ago        Up 22 minutes       22/tcp              travis

The tt image is created from quay.io/travisci/travis-ruby. I installed some packages and committed it locally.

回答1:

Commit the container again and then try saving it on the local system:

docker commit [CONTAINER-ID]

And then try to save it:

docker save -o tt.tar.gz tt:latest


回答2:

You don't have the tt image with tag name test. Try doing with latest:

docker save -o tt.tar.gz tt:latest

Or alternatively you can do:

docker save tt:latest > tt.tar


标签: docker save