[英]Docker image save how to check if exist before load?
This way I can make a backup of an existing docker image to a safe place:这样我可以将现有的 docker 映像备份到安全的地方:
docker save -o /backitup/myimage.tar myimage:v1
Then I can restore the image to another host or on the same with:然后我可以将图像恢复到另一台主机或同一台主机上:
cat /backitup/myimage.tar | docker import --message "New image imported from tarball" - myimage:v1
But how will I know if the same image is already on the host maybe with a different name?但是我怎么知道主机上是否已经存在相同的图像,可能名称不同?
REPOSITORY TAG IMAGE ID CREATED SIZE
myimage v1 1b6ef4d470ef 3 seconds ago 577MB
stillmyimage dupe a9a1468fdebf 4 minutes ago 577MB
This command replace the import and does exactly the job, load with name and don't create new if exist:此命令替换导入并完成工作,使用名称加载并且不创建新的(如果存在):
docker load < /backitup/myimage.tar
Loaded image: myimage:v1
加载的图像:myimage:v1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.