docker保存和docker加载

假设原始容器ID为abcdefabcdef , I am gonna package this container to a image

whch named image_1, then I’ll upload image_1 to a destination server. the user of destination

server is user, and ip is ip2

脚步

convert this container to an image

docker commit abcdefabcdef image_1

package this image, and save it to /image/

docker save -o /image/image_1.tar image_1_ID

upload this image to another docker physical server.

scp /image/image_1.tar -Pport user@ip2:/image/

load this image

码头工人负载 < /image/image_1.tar

check whether the image exist or not

码头工人图像

make a tag for this image

docker tag image_1_ID image_1:v.x.x

run this images

docker run option -cap-add=NET_ADMIN image_1_ID

但 , if power abnormal happend , there will be some error when the contain start, 如下

[root @ localhost〜]# docker start abcdefabcdef

Error response from daemon: Address already in use

错误: failed to start containers: abcdefabcdef

If it’s not convenient to modify the internal file, you can migrate this image

to other server and load it , then startup this container.

发表评论