②.docker image

docker image ls docker images 查看镜像的详细信息

-a 显示全部镜像信息
-q 显示镜像id

docker image prune 清除没有标签 且未使用的镜像

docker search mysql 搜索官方仓库是否存在这个镜像

docker pull mysql 拉取mysql镜像

docker rmi mysql

docker commit 保存当前容器的状态为镜像

docker commmit -p container_id  image_name:tag   #-p 暂停容器

什么是镜像

镜像是软件及软件运行环境的打包 在内核之上的环境

联合挂载分层存储

Ufs是一种分层 轻量级并且高性能的联合挂载文件系统
②.docker image
bootfs (boot file system) 主要包含 bootloader 和 kernel, bootloader主要是引导加载kernel, 当boot成功后 kernel 被加载到内存中后 bootfs就被umount了.
②.docker image
rootfs (root file system) 包含的就是典型 Linux 系统中的 /dev, /proc, /bin, /etc 等标准目录和文件

散列值

散列值的作用是区分镜像

--digests 查看本地镜像摘要 散列值
root@PC-20210619HHHN:~# docker image ls --digests
REPOSITORY               TAG       DIGEST                                                                    IMAGE ID       CREATED       SIZE
nginx                    latest    sha256:47ae43cdfc7064d28800bc42e79a429540c7c80168e8c8952778c0d5af1c09db   4f380adfc10f   11 days ago   133MB
docker/getting-started   latest    sha256:10555bb0c50e13fc4dd965ddb5f00e948ffa53c13ff15dcdc85b7ab65e1f240b   083d7564d904   3 weeks ago   28MB

使用散列值拉去镜像

root@PC-20210619HHHN:~# docker rmi alpine
Untagged: alpine:latest
Untagged: alpine@sha256:234cb88d3020898631af0ccbbcca9a66ae7306ecd30c9720690858c1b007d2a0
Deleted: sha256:d4ff818577bc193b309b355b02ebc9220427090057b54a59e73b79bdfe139b83
Deleted: sha256:72e830a4dff5f0d5225cdc0a320e85ab1ce06ea5673acfe8d83a7645cbd0e9cf
d904   3 weeks ago   28MB
root@PC-20210619HHHN:~# docker pull alpine@sha256:234cb88d3020898631af0ccbbcca9a66ae7306ecd30c9720690858c1b007d2a0
docker.io/library/alpine@sha256:234cb88d3020898631af0ccbbcca9a66ae7306ecd30c9720690858c1b007d2a0: Pulling from library/alpine
5843afab3874: Pull complete
Digest: sha256:234cb88d3020898631af0ccbbcca9a66ae7306ecd30c9720690858c1b007d2a0
Status: Downloaded newer image for alpine@sha256:234cb88d3020898631af0ccbbcca9a66ae7306ecd30c9720690858c1b007d2a0
docker.io/library/alpine@sha256:234cb88d3020898631af0ccbbcca9a66ae7306ecd30c9720690858c1b007d2a0
root@PC-20210619HHHN:~# docker image ls --digests
REPOSITORY               TAG       DIGEST                                                                    IMAGE ID       CREATED       SIZE
nginx                    latest    sha256:47ae43cdfc7064d28800bc42e79a429540c7c80168e8c8952778c0d5af1c09db   4f380adfc10f   11 days ago   133MB
alpine                   <none>    sha256:234cb88d3020898631af0ccbbcca9a66ae7306ecd30c9720690858c1b007d2a0   d4ff818577bc   2 weeks ago   5.6MB
docker/getting-started   latest    sha256:10555bb0c50e13fc4dd965ddb5f00e948ffa53c13ff15dcdc85b7ab65e1f240b   083d7564d904   3 weeks ago   28MB
上一篇:alpine制作nginx镜像


下一篇:[Alpine] 安装Alpine虚拟机,并安装docker,docker-compose