
讯享网
Docker 要求 CentOS 系统的内核版本高于 3.10 ,查看本页面的前提条件来验证你的 CentOS 版本是否支持Docker
uname -r
讯享网
使用 root 权限登录 CentOS。确保 yum 包更新到最新
讯享网sudo yum update
sudo yum remove docker docker-common docker-selinux docker-engine
讯享网sudo yum install -y yum-utils device-mapper-persistent-data lvm2
设置yum源
-
官方源
sudo yum-config-manager –add-repo https://download.docker.com/linux/centos/docker-ce.repo
- 阿里云源
讯享网sudo yum-config-manager –add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
- 清华大学源
sudo yum-config-manager –add-repo https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/docker-ce.repo
讯享网sudo yum install docker-ce
yum list docker-ce –showduplicates | sort -rsudo yum install docker-ce-版本号.ce
讯享网sudo systemctl start dockersudo systemctl enable docker
docker version
Docker CE 支持以下版本的 Ubuntu 操作系统:
-
Artful 17.10 (Docker CE 17.11 Edge +) -
Xenial 16.04 (LTS) -
Trusty 14.04 (LTS)
Docker CE 可以安装在 64 位的 x86平台或 ARM 平台上。Ubuntu 发行版中,LTS(Long-Term-Support)长期支持版本,会获得 5 年的升级维护支持,这样的版本会更稳定,因此在生产环境中推荐使用 LTS 版本,当前最新的 LTS 版本为 Ubuntu 16.04。

docker-engine,使用以下命令卸载旧版本:
讯享网sudo apt-get remove docker </span>docker-engine </span> docker.io
使用脚本自动安装
curl -fsSL get.docker.com -o get-docker.shsudo sh get-docker.sh –mirror AzureChinaCloud
讯享网sudo systemctl enable dockersudo systemctl start docker
- 先执行命令:apt-get autoremove docker-ce
- 删除 /etc/apt/sources.list.d 目录下的 docker.list 文件


Docker 镜像加速器
-
Docker 官方提供的中国 registry mirror -
阿里云加速器 -
DaoCloud 加速器
DOCKER_OPTS=“–registry-mirror=https://xxxxxxxx.mirror.aliyuncs.com”
讯享网sudo service docker restart
{“registry-mirrors”: [“https://xxxxxxxx.mirror.aliyuncs.com”]}
讯享网sudo systemctl daemon-reloadsudo systemctl restart docker
Registry Mirrors: https://xxxxxxxx.mirror.aliyuncs.com

Docker 镜像
讯享网docker pull
-
Docker 镜像仓库地址:地址的格式一般是 <域名/IP>[:端口号] 。默认地址是 Docker Hub。
\( docker pull ubuntu:16.04</span></code><code style=" margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;font-size: 14px;white-space: pre-wrap;display: flex; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; "><span class="code-snippet_outer" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span class="code-snippet__section" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(221, 17, 68);">16.04: Pulling from library/ubuntu</span></span></code><code style=" margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;font-size: 14px;white-space: pre-wrap;display: flex; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; "><span class="code-snippet_outer" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span class="code-snippet__section" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(221, 17, 68);">4f53fa4d2cf0: Pull complete </span></span></code><code style=" margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;font-size: 14px;white-space: pre-wrap;display: flex; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; "><span class="code-snippet_outer" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span class="code-snippet__section" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(221, 17, 68);">6af7c939e38e: Pull complete </span></span></code><code style=" margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;font-size: 14px;white-space: pre-wrap;display: flex; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; "><span class="code-snippet_outer" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span class="code-snippet__section" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(221, 17, 68);">903d0ffd64f6: Pull complete </span></span></code><code style=" margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;font-size: 14px;white-space: pre-wrap;display: flex; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; "><span class="code-snippet_outer" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span class="code-snippet__section" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(221, 17, 68);">04feeed388b7: Pull complete </span></span></code><code style=" margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;font-size: 14px;white-space: pre-wrap;display: flex; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; "><span class="code-snippet_outer" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span class="code-snippet__section" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(221, 17, 68);">Digest: sha256:185fec2d6dbe9165f35e4a1136b4cf09363b328d4fca191aa1475fd</span></span></code><code style=" margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;font-size: 14px;white-space: pre-wrap;display: flex; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; "><span class="code-snippet_outer" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span class="code-snippet__section" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(221, 17, 68);">Status: Downloaded newer image for ubuntu:16.04</span></span></code><code style=" margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;font-size: 14px;white-space: pre-wrap;display: flex; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; "><span class="code-snippet_outer" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span class="code-snippet__section" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(221, 17, 68);">docker.io/library/ubuntu:16.04</span></span></code></pre></section><section style="margin: 0px 8px 16px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(34, 34, 34);font-family: system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;font-size: 17px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: 0.544px;orphans: 2;text-align: justify;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;background-color: rgb(255, 255, 255);line-height: 1.75em;"><span style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;font-size: 15px;font-family: "Helvetica Neue", Helvetica, "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;letter-spacing: 1px;color: rgb(0, 0, 0);">上面的命令中没有给出 Docker 镜像仓库地址,因此将会从 Docker Hub 获取镜像。而镜像名称是 ubuntu:16.04 ,因此将会获取官方镜像 library/ubuntu 仓库中标签为 16.04 的镜像。</span></section><section style="margin: 0px 8px 16px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(34, 34, 34);font-family: system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;font-size: 17px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: 0.544px;orphans: 2;text-align: justify;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;background-color: rgb(255, 255, 255);line-height: 1.75em;"><span style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;font-size: 15px;font-family: "Helvetica Neue", Helvetica, "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;letter-spacing: 1px;color: rgb(0, 0, 0);">从下载过程中可以看到我们之前提及的分层存储的概念,镜像是由多层存储所构成。下载也是一层层的去下载,并非单一文件。下载过程中给出了每一层的 ID 的前 12 位。并且下载结束后,给出该镜像完整的 sha256 的摘要,以确保下载一致性。</span></section><section style="margin: 0px 8px 16px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(34, 34, 34);font-family: system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;font-size: 17px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: 0.544px;orphans: 2;text-align: justify;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;background-color: rgb(255, 255, 255);line-height: 1.75em;"><span style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;font-size: 15px;font-family: "Helvetica Neue", Helvetica, "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;letter-spacing: 1px;color: rgb(0, 0, 0);">在使用上面命令的时候,你可能会发现,你所看到的层 ID 以及 sha256 的摘要和这里不一样。这是因为官方镜像是一致在维护的,有任何新的 bug,或者版本更新,都会进行修复再以原来的标签发布,这样可有确保任何使用这个标签的用户可以获得更安全、更稳定的镜像。</span></section><section style="margin: 0px 8px 16px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(34, 34, 34);font-family: system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;font-size: 17px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: 0.544px;orphans: 2;text-align: justify;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;background-color: rgb(255, 255, 255);line-height: 1.75em;"><span style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;font-size: 15px;font-family: "Helvetica Neue", Helvetica, "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;letter-spacing: 1px;color: rgb(0, 0, 0);">如果从 Docker Hub 下载镜像非常缓慢,可以参照 镜像加速器 一节配置加速器。</span></section><section style="margin: 0px 8px 16px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(34, 34, 34);font-family: system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;font-size: 17px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: 0.544px;orphans: 2;text-align: justify;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;background-color: rgb(255, 255, 255);line-height: 1.75em;"><strong style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;font-family: "Helvetica Neue", Helvetica, "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;letter-spacing: 1px;color: rgb(0, 0, 0);font-size: 16px;">3.1.1 运行</span></strong></section><section style="margin: 0px 8px 16px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(34, 34, 34);font-family: system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;font-size: 17px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: 0.544px;orphans: 2;text-align: justify;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;background-color: rgb(255, 255, 255);line-height: 1.75em;"><span style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;font-size: 15px;font-family: "Helvetica Neue", Helvetica, "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;letter-spacing: 1px;color: rgb(0, 0, 0);">有了镜像后,我们就能够以这个镜像为基础启动并运行一个容器。以上面的 ubuntu:16.04 为例,如果我们打算启动里面的 bash 并且进行交互式操作的话,可以执行下面的命令。</span></section><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="makefile"><code style=" margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;font-size: 14px;white-space: pre-wrap;display: flex; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; "><span class="code-snippet_outer" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;">\) docker run -it –rm </span>ubuntu:16.04 </span>bashroot@e7009c6ce357:/# cat /etc/os-releaseNAME=“Ubuntu”VERSION=“16.04.4 LTS, Trusty Tahr”ID=ubuntuID_LIKE=debianPRETTY_NAME=“Ubuntu 16.04.4 LTS”VERSION_ID=“16.04”HOME_URL=“http://www.ubuntu.com/”SUPPORT_URL=“http://help.ubuntu.com/”BUG_REPORT_URL=“http://bugs.launchpad.net/ubuntu/”
-
it :这是两个参数,一个是 -i :交互式操作,一个是 -t 终端。我们这里打算进入 bash 执行一些命令并查看返回结果,因此我们需要交互式终端。 -
–rm :这个参数是说容器退出后随之将其删除。默认情况下,为了排障需求,退出的容器并不会立即删除,除非手动 docker rm 。我们这里只是随便执行个命令,看看结果,不需要排障和保留结果,因此使用 –rm 可以避免浪费空间。 -
ubuntu:16.04 :这是指用 ubuntu:16.04 镜像为基础来启动容器。 -
bash :放在镜像名后的是命令,这里我们希望有个交互式 Shell,因此用的是 bash。
讯享网docker system dfTYPE TOTAL ACTIVE SIZE RECLAIMABLEImages 24 0 1.992GB 1.992GB (100%)Containers 1 0 62.82MB 62.82MB (100%)Local Volumes 9 0 652.2MB 652.2MB (100%)Build Cache
<none> <none> 00285df0df87 5 days ago 342 MB
讯享网\( docker image ls -f dangling=<span class="code-snippet__literal" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(14, 156, 229);">true</span></span></code><code style=" margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;font-size: 14px;white-space: pre-wrap;display: flex; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; "><span class="code-snippet_outer" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span class="code-snippet__type" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(14, 156, 229);">REPOSITORY</span> <span class="code-snippet__type" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(14, 156, 229);">TAG</span> <span class="code-snippet__type" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(14, 156, 229);">IMAGE</span> <span class="code-snippet__type" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(14, 156, 229);">ID</span> <span class="code-snippet__type" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(14, 156, 229);">CREATED</span> <span class="code-snippet__type" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(14, 156, 229);">SIZE</span></span></code><code style=" margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;font-size: 14px;white-space: pre-wrap;display: flex; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; "><span class="code-snippet_outer" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><<span class="code-snippet__keyword" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(202, 125, 55);">none</span>> <<span class="code-snippet__keyword" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(202, 125, 55);">none</span>> 00285df0df87 <span class="code-snippet__number" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(14, 156, 229);">5</span> days ago <span class="code-snippet__number" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(14, 156, 229);">342</span> <span class="code-snippet__type" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(14, 156, 229);">MB</span></span></code></pre></section><section style="margin: 0px 8px 16px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(34, 34, 34);font-family: system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;font-size: 17px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: 0.544px;orphans: 2;text-align: justify;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;background-color: rgb(255, 255, 255);line-height: 1.75em;"><span style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;font-size: 15px;font-family: "Helvetica Neue", Helvetica, "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;letter-spacing: 1px;color: rgb(0, 0, 0);">一般来说,虚悬镜像已经失去了存在的价值,是可以随意删除的,可以用下面的命令删除。</span></section><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="shell"><code style=" margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;font-size: 14px;white-space: pre-wrap;display: flex; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; "><span class="code-snippet_outer" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span class="code-snippet__meta" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(175, 175, 175);">\) docker image prune
3.2.3 中间层镜像
docker image ls ubuntuREPOSITORY TAG IMAGE ID CREATED SIZEubuntu 16.04 fc5 4 weeks ago 127 MBubuntu latest fc5 4 weeks ago 127 MBubuntu 14.04 1e0c3dd64ccd 4 weeks ago 188 MB
讯享网docker image ls -f since=mongo:3.2REPOSITORY TAG IMAGE ID CREATED SIZEredis latest 5fc7f8 5 days ago 183 MBnginx latest 05a60462f8ba 5 days ago 181 MB
5fc7f805a60462f8bafe9198c04d6200285df0df87fc5fc51e0c3dd64ccd
讯享网\( docker image ls --format <span class="code-snippet__string" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(221, 17, 68);">"{{.ID}}: {{.Repository}}"</span></span></code><code style=" margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;font-size: 14px;white-space: pre-wrap;display: flex; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; "><span class="code-snippet_outer" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span class="code-snippet__section" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(221, 17, 68);">5fc7f8: redis</span></span></code><code style=" margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;font-size: 14px;white-space: pre-wrap;display: flex; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; "><span class="code-snippet_outer" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span class="code-snippet__section" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(221, 17, 68);">05a60462f8ba: nginx</span></span></code><code style=" margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;font-size: 14px;white-space: pre-wrap;display: flex; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; "><span class="code-snippet_outer" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span class="code-snippet__section" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(221, 17, 68);">fe9198c04d62: mongo</span></span></code><code style=" margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;font-size: 14px;white-space: pre-wrap;display: flex; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; "><span class="code-snippet_outer" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span class="code-snippet__section" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(221, 17, 68);">00285df0df87: <none></span></span></code><code style=" margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;font-size: 14px;white-space: pre-wrap;display: flex; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; "><span class="code-snippet_outer" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span class="code-snippet__section" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(221, 17, 68);">fc5: ubuntu</span></span></code><code style=" margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;font-size: 14px;white-space: pre-wrap;display: flex; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; "><span class="code-snippet_outer" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span class="code-snippet__section" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(221, 17, 68);">fc5: ubuntu</span></span></code><code style=" margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;font-size: 14px;white-space: pre-wrap;display: flex; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; "><span class="code-snippet_outer" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span class="code-snippet__section" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(221, 17, 68);">1e0c3dd64ccd: ubuntu</span></span></code></pre></section><section style="margin: 0px 8px 16px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(34, 34, 34);font-family: system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;font-size: 17px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: 0.544px;orphans: 2;text-align: justify;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;background-color: rgb(255, 255, 255);line-height: 1.75em;"><span style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;font-size: 15px;font-family: "Helvetica Neue", Helvetica, "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;letter-spacing: 1px;color: rgb(0, 0, 0);">或者打算以表格等距显示,并且有标题行,和默认一样,不过自己定义列:</span></section><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="nginx"><code style=" margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;font-size: 14px;white-space: pre-wrap;display: flex; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; "><span class="code-snippet_outer" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span class="code-snippet__attribute" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(14, 156, 229);font-weight: 400;">docker</span> image ls --format <span class="code-snippet__string" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(221, 17, 68);">"table {{.ID}}\t{{.Repository}}\t{{.Tag}}"</span></span></code></pre></section><section style="margin: 0px 8px 16px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(34, 34, 34);font-family: system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;font-size: 17px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: 0.544px;orphans: 2;text-align: justify;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;background-color: rgb(255, 255, 255);line-height: 1.75em;"><strong style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;font-family: "Helvetica Neue", Helvetica, "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;letter-spacing: 1px;color: rgb(0, 0, 0);font-size: 16px;">3.3 删除本地镜像</span></strong></section><section style="margin: 0px 8px 16px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(34, 34, 34);font-family: system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;font-size: 17px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: 0.544px;orphans: 2;text-align: justify;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;background-color: rgb(255, 255, 255);line-height: 1.75em;"><span style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;font-size: 15px;font-family: "Helvetica Neue", Helvetica, "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;letter-spacing: 1px;color: rgb(0, 0, 0);">如果想要删除本地的镜像,可以使用 docker image rm 命令,其格式为:</span></section><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="css"><code style=" margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;font-size: 14px;white-space: pre-wrap;display: flex; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; "><span class="code-snippet_outer" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span class="code-snippet__selector-tag" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(202, 125, 55);">docker</span> <span class="code-snippet__selector-tag" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(202, 125, 55);">image</span> <span class="code-snippet__selector-tag" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(202, 125, 55);">rm</span> <span class="code-snippet__selector-attr" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;">[选项]</span> <镜像1> <span class="code-snippet__selector-attr" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;">[<镜像2> ...]</span></span></code></pre></section><section style="margin: 0px 8px 16px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(34, 34, 34);font-family: system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;font-size: 17px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: 0.544px;orphans: 2;text-align: justify;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;background-color: rgb(255, 255, 255);line-height: 1.75em;"><strong style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;font-size: 15px;font-family: "Helvetica Neue", Helvetica, "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;letter-spacing: 1px;color: rgb(0, 0, 0);">3.3.1 用 ID、镜像名、摘要删除镜像</span></strong><span style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;font-size: 15px;font-family: "Helvetica Neue", Helvetica, "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;letter-spacing: 1px;color: rgb(0, 0, 0);"></span></section><section style="margin: 0px 8px 16px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(34, 34, 34);font-family: system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;font-size: 17px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: 0.544px;orphans: 2;text-align: justify;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;background-color: rgb(255, 255, 255);line-height: 1.75em;"><span style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;font-size: 15px;font-family: "Helvetica Neue", Helvetica, "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;letter-spacing: 1px;color: rgb(0, 0, 0);">其中, <镜像> 可以是 镜像短 ID、镜像长 ID、镜像名 或者 镜像摘要。</span></section><section style="margin: 0px 8px 16px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(34, 34, 34);font-family: system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;font-size: 17px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: 0.544px;orphans: 2;text-align: justify;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;background-color: rgb(255, 255, 255);line-height: 1.75em;"><span style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;font-size: 15px;font-family: "Helvetica Neue", Helvetica, "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;letter-spacing: 1px;color: rgb(0, 0, 0);">比如我们有这么一些镜像:</span></section><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="properties"><code style=" margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;font-size: 14px;white-space: pre-wrap;display: flex; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; "><span class="code-snippet_outer" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span class="code-snippet__meta" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(175, 175, 175);">\) docker image lsREPOSITORY TAG IMAGE ID CREATED SIZEcentos latest 0584b3d2cf6d 3 weeks ago 196.5 MBredis alpine 501ad78535f0 3 weeks ago 21.03 MBdocker latest cf693ec9b5c7 3 weeks ago 105.1 MBnginx latest e43d811ce2f4 5 weeks ago 181.5 MB
\( docker image rm 501</span></code><code style=" margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;font-size: 14px;white-space: pre-wrap;display: flex; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; "><span class="code-snippet_outer" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span class="code-snippet__section" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(221, 17, 68);">Untagged: redis:alpine</span></span></code><code style=" margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;font-size: 14px;white-space: pre-wrap;display: flex; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; "><span class="code-snippet_outer" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span class="code-snippet__section" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(221, 17, 68);">Untagged: redis@sha256:f1ed3708f538b537eb9c2a7dd50dc90a706f7debd7e1196c9264edeea521a86d</span></span></code><code style=" margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;font-size: 14px;white-space: pre-wrap;display: flex; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; "><span class="code-snippet_outer" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span class="code-snippet__section" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(221, 17, 68);">Deleted: sha256:501ad78535f015d88872e13fa87ae3d28075d0cb05bf189b7</span></span></code><code style=" margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;font-size: 14px;white-space: pre-wrap;display: flex; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; "><span class="code-snippet_outer" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span class="code-snippet__section" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(221, 17, 68);">Deleted: sha256:e29ca8e9d74982ef2a0dda76ed7b430da55e321c071f0dbff8c2899b</span></span></code><code style=" margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;font-size: 14px;white-space: pre-wrap;display: flex; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; "><span class="code-snippet_outer" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span class="code-snippet__section" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(221, 17, 68);">Deleted: sha256:32770d1dcf835f192cafd6b9263b7b597a1778a403a109e2cc2ee866f74adf23</span></span></code><code style=" margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;font-size: 14px;white-space: pre-wrap;display: flex; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; "><span class="code-snippet_outer" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span class="code-snippet__section" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(221, 17, 68);">Deleted: sha256:ad74a5846ffe03439d96d4b1c7f2a449c7a826ef74a2d2fa</span></span></code><code style=" margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;font-size: 14px;white-space: pre-wrap;display: flex; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; "><span class="code-snippet_outer" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span class="code-snippet__section" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(221, 17, 68);">Deleted: sha256:1333eccbac54ec0816bc17634e131ea0cc48daa27d32c75eab3</span></span></code><code style=" margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;font-size: 14px;white-space: pre-wrap;display: flex; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; "><span class="code-snippet_outer" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span class="code-snippet__section" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(221, 17, 68);">Deleted: sha256:4fc455b921edf9c4aea207c51ab39b10b06540c8b4825ba57b3feed1668fa7c7</span></span></code></pre></section><section style="margin: 0px 8px 16px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(34, 34, 34);font-family: system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;font-size: 17px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: 0.544px;orphans: 2;text-align: justify;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;background-color: rgb(255, 255, 255);line-height: 1.75em;"><span style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;font-size: 15px;font-family: "Helvetica Neue", Helvetica, "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;letter-spacing: 1px;color: rgb(0, 0, 0);">我们也可以用 镜像名 ,也就是 <仓库名>:<标签> ,来删除镜像。</span></section><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li><li></li><li></li><li></li><li></li></ul><pre class="code-snippet__js" data-lang="makefile"><code style=" margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;font-size: 14px;white-space: pre-wrap;display: flex; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; "><span class="code-snippet_outer" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;">\) docker image rm centosUntagged: centos:latestUntagged: centos@sha256:b2f9d1c0ff5f87ad099a3dac500db1b9bfa02a783a46e0d366cDeleted: sha256:0584b3d2cf6d235ee310cf14b54667db838d3f3d3033acd70fc3c48b8aDeleted: sha256:97ca462ad9eeaee1d66749d53dfa2ee32bf1faabd239d38
讯享网\( docker image ls --digests</span></code><code style=" margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;font-size: 14px;white-space: pre-wrap;display: flex; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; "><span class="code-snippet_outer" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;">REPOSITORY TAG DIGEST IMAGE ID CREATED SIZE</span></code><code style=" margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;font-size: 14px;white-space: pre-wrap;display: flex; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; "><span class="code-snippet_outer" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;">node slim <span class="code-snippet__symbol" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(221, 17, 68);">sha256:</span>b4f0e0bdebc1ea6862f0d40cc4afe32a4a582f3be235a3bbe228 <span class="code-snippet__number" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(14, 156, 229);">6</span>e0c4c8e3913 <span class="code-snippet__number" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(14, 156, 229);">3</span> weeks ago <span class="code-snippet__number" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(14, 156, 229);">214</span> MB</span></code><code style=" margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;font-size: 14px;white-space: pre-wrap;display: flex; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; "><span class="code-snippet_outer"><br /></span></code><code style=" margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;font-size: 14px;white-space: pre-wrap;display: flex; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; "><span class="code-snippet_outer" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;">\) docker image rm node@sha256:b4f0e0bdebc1ea6862f0d40cc4afe32a4a582f3be235a3bbe228Untagged: node@sha256:b4f0e0bdebc1ea6862f0d40cc4afe32a4a582f3be235a3bbe228
docker image rm \((docker image ls -q redis)</span></code></pre></section><section style="margin: 0px 8px 16px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;color: rgb(34, 34, 34);font-family: system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;font-size: 17px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: 0.544px;orphans: 2;text-align: justify;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;background-color: rgb(255, 255, 255);line-height: 1.75em;"><span style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;font-size: 15px;font-family: "Helvetica Neue", Helvetica, "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;letter-spacing: 1px;color: rgb(0, 0, 0);">或者删除所有在 mongo:3.2 之前的镜像:</span></section><section class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="javascript"><code style=" margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;text-align: left;font-size: 14px;white-space: pre-wrap;display: flex; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; "><span class="code-snippet_outer" style="margin: 0px;padding: 0px;outline: 0px;max-width: 1000%;box-sizing: border-box !important;overflow-wrap: break-word !important;">docker image rm \)(docker image ls -q -f before=mongo:3.2)

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/186122.html