How do I use Docker save to backup a local image to a file?

半腔热情 提交于 2019-12-23 03:39:29

问题


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


来源:https://stackoverflow.com/questions/45535790/how-do-i-use-docker-save-to-backup-a-local-image-to-a-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!