Docker镜像的导入和导出

警告
本文最后更新于 2023-02-26,文中内容可能已过时。
1
for name in $(docker image ls | awk 'NR>1 {print $1":"$2}'); do newName=${name//\//\-}; docker save $name | gzip > "$newName.tar.gz"; done
  • docker image ls:显示所有镜像
  • NR>1:跳过第一行
  • newName=${name//\//\-}: 将 bitnami/kafka:3.4的名字替换成bitnami-kafka:3.4
1
for name in $(ls); do docker load -i $name; done

How to copy Docker images from one host to another without using a repository

How to Skip the First Line of a File Using awk

Replacing some characters in a string with another character

相关内容