Skip to content

镜像 ​


更新于 2024-02-14

镜像包含基础操作系统以及应用程序运行所需的代码和依赖包。
镜像由多个层组成,每层叠加之后,从外部看就如一个独立的对象

命令 ​

shell
docker image --help

拉取镜像 ​

shell
docker pull [OPTIONS] NAME[:TAG|@DIGEST]

导出本地镜像 ​

shell
docker save -o <path_to_output_file>.tar <image_name>:<tag>

加载本地镜像 ​

shell
docker load [OPTIONS]

提交镜像 ​

shell
docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]
#OPTIONS说明:
#-a :提交的镜像作者;
#-c :使用Dockerfile指令来创建镜像;
#-m :提交时的说明文字;
#-p :在commit时,将容器暂停。

删除镜像 ​

shell
docker rmi [OPTIONS] IMAGE [IMAGE...]
docker image rm IMAGE