Docker image export is saved as tar and tar package is imported into docker image

View container

docker ps -a

View image

 docker images

export container

  1. docker commitCommand to generate a new image from the container
# 1.0是镜像版本
docker commit  -a "打包作者名" -m "打包提交信息" 容器ID 镜像名称:1.0
  1. docker exportcommand to package the container into tar,
#方式一
docker export docker容器的ID > tar包名字.tar
#方式二
docker export  -o tar包名字.tar docker容器的ID

Export image

  1. Use to package multiple imagesdocker save into one file at the same time , for example, package AAA and BBB in the mirror library below ,
# AAA:8.2,8.2表示镜像版本号
docker save -o tar名称.tar AAA:8.2 BBB:5.6

Import image

  1. Use docker importthe command to import the image file of the tar package.
#方式一
docker import - 要设置的镜像名字 < tar包名字.tar
#方式二
docker import  tar包名字.tar 镜像名称:版本id
  1. Use docker loadthe command: Import docker savethe image tar package exported with the command
docker load -i tar包名称.tar
# -i ,--input 简写, : 指定导入的文件,代替 STDIN。
#-q ,--quiet  简写,  : 精简输出信息。

Guess you like

Origin blog.csdn.net/blood_Z/article/details/126038450