id: 3c2f04eafb1448eebce0a0b663a44345
parent_id: 
item_type: 1
item_id: 78fc832476bf46f8bf6d4fb9bac580ac
item_updated_time: 1764345628262
title_diff: "[{\"diffs\":[[1,\"Docker 常用命令详解\"]],\"start1\":0,\"start2\":0,\"length1\":0,\"length2\":13}]"
body_diff: "[{\"diffs\":[[1,\"<html>\\\r\\\n<head>\\\r\\\n  <title>Docker 常用命令详解</title>\\\r\\\n  <basefont face=\\\"微软雅黑\\\" size=\\\"2\\\" />\\\r\\\n  <meta http-equiv=\\\"Content-Type\\\" content=\\\"text/html;charset=utf-8\\\" />\\\r\\\n  <meta name=\\\"exporter-version\\\" content=\\\"YXBJ Windows/608924 (zh-CN, DDL); Windows/10.0.0 (Win64); EDAMVersion=V2;\\\"/>\\\r\\\n  <meta name=\\\"content-class\\\" content=\\\"yinxiang.peso.superNote\\\"/>\\\r\\\n  <meta name=\\\"application-data:yinxiang.noteLayout\\\" content=\\\"{\\\"lineSpace\\\":\\\"recommend\\\",\\\"paragraphSpace\\\":\\\"recommend\\\"}\\\"/>\\\r\\\n  <style>\\\r\\\n\\tbody, td {\\\r\\\n\\t  font-family: 微软雅黑;\\\r\\\n\\t  font-size: 12pt;\\\r\\\n\\t}\\\r\\\n  </style>\\\r\\\n</head>\\\r\\\n<body>\\\r\\\n<a name=\\\"40424\\\"></a>\\\r\\\n<h1>Docker 常用命令详解</h1>\\\r\\\n\\\r\\\n<div><span style=\\\"margin:0px;\\\"><div style=\\\"padding:8px 0px;margin:8px auto;max-width:700px;\\\"> <div><span></span></div>\\\n<p></p>\\\n<div style=\\\"--en-blockquote:true;box-sizing: border-box; padding-left: 19px; padding-top: 6px; padding-bottom: 6px; border-left: 3px solid #b4c0cc; background-position: initial initial; background-repeat: initial initial; margin-top: 6px\\\"><div>原文链接: <a href=\\\"http://mp.weixin.qq.com/s?__biz=MzI0OTYwMzUyOA==&amp;mid=2247483900&amp;idx=1&amp;sn=bb2c0c872682d72ab582e1fbdf2c23bb&amp;chksm=e80eee96c57f26ea4ea16715aca0ef1ac55b5bb582af439c7102d3169a6f5c3b822cdd4268c5&amp;mpshare=1&amp;scene=1&amp;srcid=0421AqTWh7NJLjzqByDvHldq&amp;sharer_shareinfo=3051ec8c02ca3f5de0db629f3571902a&amp;sharer_shareinfo_first=3051ec8c02ca3f5de0db629f3571902a#rd\\\"><span>http://mp.weixin.qq.com/s?__biz=MzI0OTYwMzUyOA==&amp;mid=2247483...</span></a></div></div>\\\n<p></p>\\\n<div><span></span></div>\\\n<div style=\\\"\\\"><div><div><h1 style=\\\"margin:0\\\"> Docker 常用命令详解 </h1><div><span style=\\\"position:relative\\\">原创</span><span><span style=\\\"position:relative\\\">程序员平</span></span><span><a style=\\\"position:relative\\\"> 程序员平 </a></span><span><em></em></span></div><div style=\\\";\\\"><p style=\\\"margin:0;letter-spacing:1px\\\"><span> </span></p><div style=\\\"letter-spacing: 1px;\\\"><div style=\\\"padding: 15px;font-size: 0px;letter-spacing: 1px;\\\"><div style=\\\"display: flex;justify-content: flex-start;align-items: center;flex-direction: column;letter-spacing: 1px;\\\"><div style=\\\"align-self: flex-start;z-index: 2;margin-bottom: -8.1px;margin-left: -4.1px;letter-spacing: 1px;\\\"><div style=\\\"width: 11px;height: 11px;background: rgb(199, 174, 82);z-index: 2;letter-spacing: 1px;\\\"><span><br/></span></div><div style=\\\"width: 6px;height: 6px;background: rgb(223, 203, 131);z-index: 3;margin-top: -4.1px;margin-left: 7px;letter-spacing: 1px;\\\"><span><br/></span></div></div><div style=\\\"background: rgb(255, 255, 255);border-width: 1px;border-style: solid;border-color: rgb(199, 174, 82);padding: 15px 16px 18px 17px;letter-spacing: 1px;\\\"><div style=\\\"letter-spacing: 1px;\\\"><p style=\\\"margin:0;font-size:14px;font-family:PingFangSC-Regular,&quot;PingFang SC&quot;;color:rgb(51,51,51);line-height:20px;word-break:break-all;letter-spacing:1px\\\"><strong><span>Docker 是一个强大的容器化平台，广泛用于开发、测试和生产环境。通过 Docker 命令行工具（CLI），我们可以轻松管理容器、镜像、网络和卷等资源。本文将详细介绍 Docker 的常用命令，带你熟练掌握 Docker 的核心操作命令。</span><span><br/></span></strong></p><p style=\\\"margin:0;font-size:14px;font-family:PingFangSC-Regular,&quot;PingFang SC&quot;;color:rgb(51,51,51);line-height:20px;word-break:break-all;letter-spacing:1px\\\"><strong><span><br/></span></strong></p><p style=\\\"margin:0;font-size:14px;font-family:PingFangSC-Regular,&quot;PingFang SC&quot;;color:rgb(51,51,51);line-height:20px;word-break:break-all;letter-spacing:1px\\\"><strong><span><br/></span></strong></p><p style=\\\"margin:0;font-size:14px;font-family:PingFangSC-Regular,&quot;PingFang SC&quot;;color:rgb(51,51,51);line-height:20px;word-break:break-all;letter-spacing:1px\\\"><strong><span>在开始之前，确保你已经安装了 Docker（可以通过 docker --version 检查版本）。本文假设你对 Docker 的基本概念（如容器、镜像等）有一定了解。如果你是新手，别担心，我会尽量用通俗的语言解释每个命令。</span></strong></p><p style=\\\"margin:0\\\"><span>Docker 是一个强大的容器化平台，广泛用于开发、测试和生产环境。通过 Docker 命令行工具（CLI），我们可以轻松管理容器、镜像、网络和卷等资源。本文将详细介绍 Docker 的常用命令，带你从入门到熟练掌握 Docker 的核心操作。</span></p><p style=\\\"margin:0\\\"><span>Docker 是一个强大的容器化平台，广泛用于开发、测试和生产环境。通过 Docker 命令行工具（CLI），我们可以轻松管理容器、镜像、网络和卷等资源。本文将详细介绍 Docker 的常用命令，带你从入门到熟练掌握 Docker 的核心操作。</span></p></div></div></div></div></div><div style=\\\"letter-spacing: 1px;\\\"><div style=\\\"margin: 10px auto;letter-spacing: 1px;\\\"><div style=\\\"width: 100%;font-size: 18px;height: 40px;line-height: 40px;border-bottom: 2px solid rgb(30, 28, 28);text-align: left;letter-spacing: 1px;\\\"><strong style=\\\"letter-spacing: 1px;\\\"><span>一、 </span><span>镜像管理相关的命令</span></strong></div></div><div style=\\\"font-size: 16px;color: black;padding: 25px 30px;line-height: 1.6;word-spacing: 0px;letter-spacing: 0px;word-break: break-word;word-wrap: break-word;text-align: justify;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;margin-top: -10px;\\\"><blockquote style=\\\"display: block;font-size: 0.9em;overflow: auto;overflow-scrolling: touch;border-left: 3px solid rgba(0, 0, 0, 0.4);background: rgba(0, 0, 0, 0.05);padding-top: 10px;padding-bottom: 10px;border-left-color: rgb(221, 221, 221);margin-top: 1.2em;margin-bottom: 1.2em;padding-right: 1em;padding-left: 1em;border-left-width: 4px;color: rgb(119, 119, 119);quotes: none;\\\"><p style=\\\"padding-top:8px;padding-bottom:8px;box-sizing:border-box;margin-bottom:16px;text-align:start;white-space:normal;text-size-adjust:auto;margin:0;font-size:15px;font-family:-apple-system-font,BlinkMacSystemFont,'Helvetica Neue','PingFang SC','Hiragino Sans GB','Microsoft YaHei UI','Microsoft YaHei',Arial,sans-serif;color:rgb(119,119,119);line-height:1.75em\\\"><span>Docker 镜像是容器的基础。</span></p></blockquote><h2 style=\\\"margin-top:30px;margin-bottom:15px;font-weight:bold;color:black;font-size:22px;margin:10px auto;height:40px;background-color:rgb(251,251,251);border-bottom:1px solid rgb(246,246,246);overflow:hidden;box-sizing:border-box\\\"><span style=\\\"margin-left: -10px;display: inline-block;width: auto;height: 40px;background-color: rgb(33, 33, 34);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 30px;padding-left: 30px;line-height: 40px;font-size: 16px;\\\"><span>拉取镜像</span></span></h2><div><pre><div style=\\\"--en-codeblock:true;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\"><span><span>docker</span> pull<span> [镜像名称]:[标签]</span></span></div></pre></div><ul style=\\\"margin:0;margin-top:8px;margin-bottom:8px;padding-left:25px;color:black;list-style-type:disc\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;font-size: 15px;font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif;\\\"><span>如果不指定标签，默认拉取 latest 版本</span></div></li></ul><h2 style=\\\"margin-top:30px;margin-bottom:15px;font-weight:bold;color:black;font-size:22px;margin:10px auto;height:40px;background-color:rgb(251,251,251);border-bottom:1px solid rgb(246,246,246);overflow:hidden;box-sizing:border-box\\\"><span style=\\\"margin-left: -10px;display: inline-block;width: auto;height: 40px;background-color: rgb(33, 33, 34);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 30px;padding-left: 30px;line-height: 40px;font-size: 16px;\\\"><span>列出本地所有镜像</span></span></h2><div><pre><div style=\\\"--en-codeblock:true;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\"><span><span>docker</span> images</span></div></pre></div><ul style=\\\"margin:0;margin-top:8px;margin-bottom:8px;padding-left:25px;color:black;list-style-type:disc\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;font-size: 15px;font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif;\\\"><span>-a: 显示所有镜像（包括中间层镜像）</span></div></li><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;font-size: 15px;font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif;\\\"><span>-q: 只显示镜像 ID</span></div></li></ul><h2 style=\\\"margin-top:30px;margin-bottom:15px;font-weight:bold;color:black;font-size:22px;margin:10px auto;height:40px;background-color:rgb(251,251,251);border-bottom:1px solid rgb(246,246,246);overflow:hidden;box-sizing:border-box\\\"><span style=\\\"margin-left: -10px;display: inline-block;width: auto;height: 40px;background-color: rgb(33, 33, 34);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 30px;padding-left: 30px;line-height: 40px;font-size: 16px;\\\"><span>根据 Dockerfile 构建镜像</span></span></h2><div><pre><div style=\\\"--en-codeblock:true;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\"><span>docker build -t <span>[镜像名称]</span>:[标签] [Dockerfile路径]</span><div><span><br/></span></div><div><span>示例:</span></div><div><span>docker build -t myapp:<span>1.0</span> .</span></div></div></pre></div><ul style=\\\"margin:0;margin-top:8px;margin-bottom:8px;padding-left:25px;color:black;list-style-type:disc\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;font-size: 15px;font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif;\\\"><span>-t 指定镜像名称和标签</span></div></li><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;font-size: 15px;font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif;\\\"><span>. 表示使用当前目录下的 Dockerfile</span></div></li></ul><h2 style=\\\"margin-top:30px;margin-bottom:15px;font-weight:bold;color:black;font-size:22px;margin:10px auto;height:40px;background-color:rgb(251,251,251);border-bottom:1px solid rgb(246,246,246);overflow:hidden;box-sizing:border-box\\\"><span style=\\\"margin-left: -10px;display: inline-block;width: auto;height: 40px;background-color: rgb(33, 33, 34);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 30px;padding-left: 30px;line-height: 40px;font-size: 16px;\\\"><span>删除本地镜像</span></span></h2><div><pre><div style=\\\"--en-codeblock:true;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\"><span><span>docker</span> rmi<span> [镜像名称或ID]</span></span></div></pre></div><ul style=\\\"margin:0;margin-top:8px;margin-bottom:8px;padding-left:25px;color:black;list-style-type:disc\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;font-size: 15px;font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif;\\\"><span>-f: 强制删除，即使镜像正在被容器使用。</span></div></li></ul></div></div><div><div style=\\\"margin: 10px auto;letter-spacing: 1px;\\\"><div style=\\\"width: 100%;font-size: 18px;height: 40px;line-height: 40px;border-bottom: 2px solid rgb(30, 28, 28);text-align: left;\\\"><strong><span>二、 </span><span>容器管理命令</span></strong></div></div><div style=\\\"font-size: 16px;color: black;padding: 25px 30px;line-height: 1.6;word-spacing: 0px;letter-spacing: 0px;word-break: break-word;word-wrap: break-word;text-align: justify;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;margin-top: -10px;\\\"><blockquote style=\\\"display: block;font-size: 0.9em;overflow: auto;overflow-scrolling: touch;border-left: 3px solid rgba(0, 0, 0, 0.4);background: rgba(0, 0, 0, 0.05);padding-top: 10px;padding-bottom: 10px;border-left-color: rgb(221, 221, 221);margin-top: 1.2em;margin-bottom: 1.2em;padding-right: 1em;padding-left: 1em;border-left-width: 4px;color: rgb(119, 119, 119);quotes: none;\\\"><p style=\\\"padding-top:8px;padding-bottom:8px;box-sizing:border-box;margin-bottom:16px;text-align:start;white-space:normal;text-size-adjust:auto;margin:0;font-size:15px;font-family:-apple-system-font,BlinkMacSystemFont,'Helvetica Neue','PingFang SC','Hiragino Sans GB','Microsoft YaHei UI','Microsoft YaHei',Arial,sans-serif;color:rgb(119,119,119);line-height:1.75em\\\"><span>容器是 Docker 的核心。</span></p></blockquote><h2 style=\\\"margin-top:30px;margin-bottom:15px;font-weight:bold;color:black;font-size:22px;margin:10px auto;height:40px;background-color:rgb(251,251,251);border-bottom:1px solid rgb(246,246,246);overflow:hidden;box-sizing:border-box\\\"><span style=\\\"margin-left: -10px;display: inline-block;width: auto;height: 40px;background-color: rgb(33, 33, 34);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 30px;padding-left: 30px;line-height: 40px;font-size: 16px;\\\"><span>创建并运行新容器</span></span></h2><div><pre><div style=\\\"--en-codeblock:true;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\"><span>docker run <span>[选项]</span> <span>[镜像名称]</span> <span>[命令]</span></span></div></pre></div><ul style=\\\"margin:0;margin-top:8px;margin-bottom:8px;padding-left:25px;color:black;list-style-type:disc\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;font-size: 15px;font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif;\\\"><span>-d: 后台运行</span></div></li><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;font-size: 15px;font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif;\\\"><span>-p [主机端口]:[容器端口]: 端口映射</span></div></li><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;font-size: 15px;font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif;\\\"><span>--name: 指定容器名称</span></div></li><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;font-size: 15px;font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif;\\\"><span>-it: 交互式运行（常用于启动 shell）</span></div></li></ul><h2 style=\\\"margin-top:30px;margin-bottom:15px;font-weight:bold;color:black;font-size:22px;margin:10px auto;height:40px;background-color:rgb(251,251,251);border-bottom:1px solid rgb(246,246,246);overflow:hidden;box-sizing:border-box\\\"><span style=\\\"margin-left: -10px;display: inline-block;width: auto;height: 40px;background-color: rgb(33, 33, 34);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 30px;padding-left: 30px;line-height: 40px;font-size: 16px;\\\"><span>列出正在运行的容器</span></span></h2><div><pre><div style=\\\"--en-codeblock:true;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\"><span><span>docker</span> ps</span></div></pre></div><ul style=\\\"margin:0;margin-top:8px;margin-bottom:8px;padding-left:25px;color:black;list-style-type:disc\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;font-size: 15px;font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif;\\\"><span>-a: 显示所有容器（包括停止的）</span></div></li><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;font-size: 15px;font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif;\\\"><span>-q: 只显示容器 ID</span></div></li></ul><h2 style=\\\"margin-top:30px;margin-bottom:15px;font-weight:bold;color:black;font-size:22px;margin:10px auto;height:40px;background-color:rgb(251,251,251);border-bottom:1px solid rgb(246,246,246);overflow:hidden;box-sizing:border-box\\\"><span style=\\\"margin-left: -10px;display: inline-block;width: auto;height: 40px;background-color: rgb(33, 33, 34);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 30px;padding-left: 30px;line-height: 40px;font-size: 16px;\\\"><span>停止运行中的容器</span></span></h2><div><pre><div style=\\\"--en-codeblock:true;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\"><span><span>docker</span> stop<span> [容器名称或ID]</span></span></div></pre></div><h2 style=\\\"margin-top:30px;margin-bottom:15px;font-weight:bold;color:black;font-size:22px;margin:10px auto;height:40px;background-color:rgb(251,251,251);border-bottom:1px solid rgb(246,246,246);overflow:hidden;box-sizing:border-box\\\"><span style=\\\"margin-left: -10px;display: inline-block;width: auto;height: 40px;background-color: rgb(33, 33, 34);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 30px;padding-left: 30px;line-height: 40px;font-size: 16px;\\\"><span>启动已停止的容器</span></span></h2><div><pre><div style=\\\"--en-codeblock:true;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\"><span><span>docker</span> start<span> [容器名称或ID]</span></span></div></pre></div><h2 style=\\\"margin-top:30px;margin-bottom:15px;font-weight:bold;color:black;font-size:22px;margin:10px auto;height:40px;background-color:rgb(251,251,251);border-bottom:1px solid rgb(246,246,246);overflow:hidden;box-sizing:border-box\\\"><span style=\\\"margin-left: -10px;display: inline-block;width: auto;height: 40px;background-color: rgb(33, 33, 34);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 30px;padding-left: 30px;line-height: 40px;font-size: 16px;\\\"><span>重启容器</span></span></h2><div><pre><div style=\\\"--en-codeblock:true;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\"><span><span>docker</span> restart<span> [容器名称或ID]</span></span></div></pre></div><h2 style=\\\"margin-top:30px;margin-bottom:15px;font-weight:bold;color:black;font-size:22px;margin:10px auto;height:40px;background-color:rgb(251,251,251);border-bottom:1px solid rgb(246,246,246);overflow:hidden;box-sizing:border-box\\\"><span style=\\\"margin-left: -10px;display: inline-block;width: auto;height: 40px;background-color: rgb(33, 33, 34);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 30px;padding-left: 30px;line-height: 40px;font-size: 16px;\\\"><span>删除容器</span></span></h2><div><pre><div style=\\\"--en-codeblock:true;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\"><span><span>docker</span> rm<span> [容器名称或ID]</span></span></div></pre></div><ul style=\\\"margin:0;margin-top:8px;margin-bottom:8px;padding-left:25px;color:black;list-style-type:disc\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;font-size: 15px;font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif;\\\"><span>-f: 强制删除正在运行的容器。</span></div></li></ul><h2 style=\\\"margin-top:30px;margin-bottom:15px;font-weight:bold;color:black;font-size:22px;margin:10px auto;height:40px;background-color:rgb(251,251,251);border-bottom:1px solid rgb(246,246,246);overflow:hidden;box-sizing:border-box\\\"><span style=\\\"margin-left: -10px;display: inline-block;width: auto;height: 40px;background-color: rgb(33, 33, 34);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 30px;padding-left: 30px;line-height: 40px;font-size: 16px;\\\"><span>在运行中的容器内执行命令</span></span></h2><div><pre><div style=\\\"--en-codeblock:true;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\"><span>docker exec <span>[选项]</span> <span>[容器名称或ID]</span> <span>[命令]</span></span><div><span><br/></span></div><div><span>示例:</span></div><div><span>docker exec -it my-nginx bash</span></div></div></pre></div><ul style=\\\"margin:0;margin-top:8px;margin-bottom:8px;padding-left:25px;color:black;list-style-type:disc\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1,1,1);font-weight: 500;font-size: 15px;font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif;\\\"><span>-it 表示交互式终端，进入容器内的 bash 环境</span></div></li></ul><h2 style=\\\"margin-top:30px;margin-bottom:15px;font-weight:bold;color:black;font-size:22px;margin:10px auto;height:40px;background-color:rgb(251,251,251);border-bottom:1px solid rgb(246,246,246);overflow:hidden;box-sizing:border-box\\\"><span style=\\\"margin-left: -10px;display: inline-block;width: auto;height: 40px;background-color: rgb(33, 33, 34);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 30px;padding-left: 30px;line-height: 40px;font-size: 16px;\\\"><span>查看容器日志</span></span></h2><div><pre><div style=\\\"--en-codeblock:true;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\"><span><span>docker</span> logs<span> [容器名称或ID]</span></span></div></pre></div></div><div style=\\\"margin: 10px auto;letter-spacing: 1px;\\\"><div style=\\\"width: 100%;font-size: 18px;height: 40px;line-height: 40px;border-bottom: 2px solid rgb(30, 28, 28);text-align: left;\\\"><strong><span>三、 </span><span>网络管理和存储相关命令</span></strong></div></div><div style=\\\"font-size: 16px;color: black;padding: 25px 30px;line-height: 1.6;word-spacing: 0px;letter-spacing: 0px;word-break: break-word;word-wrap: break-word;text-align: justify;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;margin-top: -10px;\\\"><h2 style=\\\"margin-top:30px;margin-bottom:15px;font-weight:bold;color:black;font-size:22px;margin:10px auto;height:40px;background-color:rgb(251,251,251);border-bottom:1px solid rgb(246,246,246);overflow:hidden;box-sizing:border-box\\\"><span style=\\\"margin-left: -10px;display: inline-block;width: auto;height: 40px;background-color: rgb(33, 33, 34);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 30px;padding-left: 30px;line-height: 40px;font-size: 16px;\\\"><span>列出所有网络</span></span></h2><div><pre><div style=\\\"--en-codeblock:true;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\"><span>docker network <span>ls</span></span></div></pre></div><h2 style=\\\"margin-top:30px;margin-bottom:15px;font-weight:bold;color:black;font-size:22px;margin:10px auto;height:40px;background-color:rgb(251,251,251);border-bottom:1px solid rgb(246,246,246);overflow:hidden;box-sizing:border-box\\\"><span style=\\\"margin-left: -10px;display: inline-block;width: auto;height: 40px;background-color: rgb(33, 33, 34);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 30px;padding-left: 30px;line-height: 40px;font-size: 16px;\\\"><span>创建一个新的网络</span></span></h2><div><pre><div style=\\\"--en-codeblock:true;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\"><span><span>docker</span> network create<span> [网络名称]</span></span></div></pre></div><h2 style=\\\"margin-top:30px;margin-bottom:15px;font-weight:bold;color:black;font-size:22px;margin:10px auto;height:40px;background-color:rgb(251,251,251);border-bottom:1px solid rgb(246,246,246);overflow:hidden;box-sizing:border-box\\\"><span style=\\\"margin-left: -10px;display: inline-block;width: auto;height: 40px;background-color: rgb(33, 33, 34);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 30px;padding-left: 30px;line-height: 40px;font-size: 16px;\\\"><span>将容器连接到指定网络</span></span></h2><div><pre><div style=\\\"--en-codeblock:true;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\"><span>docker network connect <span>[网络名称]</span> <span>[容器名称或ID]</span></span></div></pre></div><h2 style=\\\"margin-top:30px;margin-bottom:15px;font-weight:bold;color:black;font-size:22px;margin:10px auto;height:40px;background-color:rgb(251,251,251);border-bottom:1px solid rgb(246,246,246);overflow:hidden;box-sizing:border-box\\\"><span style=\\\"margin-left: -10px;display: inline-block;width: auto;height: 40px;background-color: rgb(33, 33, 34);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 30px;padding-left: 30px;line-height: 40px;font-size: 16px;\\\"><span>列出所有卷</span></span></h2><div><pre><div style=\\\"--en-codeblock:true;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\"><span>docker volume <span>ls</span></span></div></pre></div><h2 style=\\\"margin-top:30px;margin-bottom:15px;font-weight:bold;color:black;font-size:22px;margin:10px auto;height:40px;background-color:rgb(251,251,251);border-bottom:1px solid rgb(246,246,246);overflow:hidden;box-sizing:border-box\\\"><span style=\\\"margin-left: -10px;display: inline-block;width: auto;height: 40px;background-color: rgb(33, 33, 34);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 30px;padding-left: 30px;line-height: 40px;font-size: 16px;\\\"><span>创建新的卷</span></span></h2><div><pre><div style=\\\"--en-codeblock:true;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\"><span><span>docker</span> volume create<span> [卷名称]</span></span></div></pre></div><h2 style=\\\"margin-top:30px;margin-bottom:15px;font-weight:bold;color:black;font-size:22px;margin:10px auto;height:40px;background-color:rgb(251,251,251);border-bottom:1px solid rgb(246,246,246);overflow:hidden;box-sizing:border-box\\\"><span style=\\\"margin-left: -10px;display: inline-block;width: auto;height: 40px;background-color: rgb(33, 33, 34);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 30px;padding-left: 30px;line-height: 40px;font-size: 16px;\\\"><span>运行容器时挂载卷或目录</span></span></h2><div><pre><div style=\\\"--en-codeblock:true;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\"><span><span>docker</span> run -v<span> [主机路径或卷名称]:[容器路径] [镜像名称]</span></span></div></pre></div></div><div style=\\\"margin: 10px auto;letter-spacing: 1px;\\\"><div style=\\\"width: 100%;font-size: 18px;height: 40px;line-height: 40px;border-bottom: 2px solid rgb(30, 28, 28);text-align: left;\\\"><strong><span>四</span><strong><span>、 </span><span>实用组合命令</span></strong></strong></div></div><div style=\\\"font-size: 16px;color: black;padding: 25px 30px;line-height: 1.6;word-spacing: 0px;letter-spacing: 0px;word-break: break-word;word-wrap: break-word;text-align: justify;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;margin-top: -10px;\\\"><h2 style=\\\"margin-top:30px;margin-bottom:15px;font-weight:bold;color:black;font-size:22px;margin:10px auto;height:40px;background-color:rgb(251,251,251);border-bottom:1px solid rgb(246,246,246);overflow:hidden;box-sizing:border-box\\\"><span style=\\\"margin-left: -10px;display: inline-block;width: auto;height: 40px;background-color: rgb(33, 33, 34);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 30px;padding-left: 30px;line-height: 40px;font-size: 16px;\\\"><span>清理无用资源</span></span></h2><div><pre><div style=\\\"--en-codeblock:true;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\"><span><span>docker</span> system prune</span></div></pre></div><h2 style=\\\"margin-top:30px;margin-bottom:15px;font-weight:bold;color:black;font-size:22px;margin:10px auto;height:40px;background-color:rgb(251,251,251);border-bottom:1px solid rgb(246,246,246);overflow:hidden;box-sizing:border-box\\\"><span style=\\\"margin-left: -10px;display: inline-block;width: auto;height: 40px;background-color: rgb(33, 33, 34);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 30px;padding-left: 30px;line-height: 40px;font-size: 16px;\\\"><span>查看容器资源使用情况</span></span></h2><div><pre><div style=\\\"--en-codeblock:true;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\"><span><span>docker</span> stats</span></div></pre></div><h2 style=\\\"margin-top:30px;margin-bottom:15px;font-weight:bold;color:black;font-size:22px;margin:10px auto;height:40px;background-color:rgb(251,251,251);border-bottom:1px solid rgb(246,246,246);overflow:hidden;box-sizing:border-box\\\"><span style=\\\"margin-left: -10px;display: inline-block;width: auto;height: 40px;background-color: rgb(33, 33, 34);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 30px;padding-left: 30px;line-height: 40px;font-size: 16px;\\\"><span>批量删除容器</span></span></h2><div><pre><div style=\\\"--en-codeblock:true;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\"><span>docker <span>rm</span> <span>-f</span> <span>$</span>(docker <span>ps</span> <span>-aq</span>)</span></div></pre></div><h2 style=\\\"margin-top:30px;margin-bottom:15px;font-weight:bold;color:black;font-size:22px;margin:10px auto;height:40px;background-color:rgb(251,251,251);border-bottom:1px solid rgb(246,246,246);overflow:hidden;box-sizing:border-box\\\"><span style=\\\"margin-left: -10px;display: inline-block;width: auto;height: 40px;background-color: rgb(33, 33, 34);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 30px;padding-left: 30px;line-height: 40px;font-size: 16px;\\\"><span>为现有镜像添加标签</span></span></h2><div><pre><div style=\\\"--en-codeblock:true;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\"><span>docker tag <span>[源镜像]</span> <span>[新镜像名称]</span>:[新标签]</span></div></pre></div><h2 style=\\\"margin-top:30px;margin-bottom:15px;font-weight:bold;color:black;font-size:22px;margin:10px auto;height:40px;background-color:rgb(251,251,251);border-bottom:1px solid rgb(246,246,246);overflow:hidden;box-sizing:border-box\\\"><span style=\\\"margin-left: -10px;display: inline-block;width: auto;height: 40px;background-color: rgb(33, 33, 34);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 30px;padding-left: 30px;line-height: 40px;font-size: 16px;\\\"><span>推送到远程仓库</span></span></h2><div><pre><div style=\\\"--en-codeblock:true;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\"><span><span>docker</span> push<span> [镜像名称]:[标签]</span></span></div></pre></div><h2 style=\\\"margin-top:30px;margin-bottom:15px;font-weight:bold;color:black;font-size:22px;margin:10px auto;height:40px;background-color:rgb(251,251,251);border-bottom:1px solid rgb(246,246,246);overflow:hidden;box-sizing:border-box\\\"><span style=\\\"margin-left: -10px;display: inline-block;width: auto;height: 40px;background-color: rgb(33, 33, 34);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 30px;padding-left: 30px;line-height: 40px;font-size: 16px;\\\"><span>查看容器内运行的进程</span></span></h2><div><pre><div style=\\\"--en-codeblock:true;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\"><span>docker <span>top</span> <span>[容器ID或名称]</span></span></div></pre></div><h2 style=\\\"margin-top:30px;margin-bottom:15px;font-weight:bold;color:black;font-size:22px;margin:10px auto;height:40px;background-color:rgb(251,251,251);border-bottom:1px solid rgb(246,246,246);overflow:hidden;box-sizing:border-box\\\"><span style=\\\"margin-left: -10px;display: inline-block;width: auto;height: 40px;background-color: rgb(33, 33, 34);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 30px;padding-left: 30px;line-height: 40px;font-size: 16px;\\\"><span>重命名容器</span></span></h2><div><pre><div style=\\\"--en-codeblock:true;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\"><span>docker rename <span>[旧名称]</span> <span>[新名称]</span></span></div></pre></div><h2 style=\\\"margin-top:30px;margin-bottom:15px;font-weight:bold;color:black;font-size:22px;margin:10px auto;height:40px;background-color:rgb(251,251,251);border-bottom:1px solid rgb(246,246,246);overflow:hidden;box-sizing:border-box\\\"><span style=\\\"margin-left: -10px;display: inline-block;width: auto;height: 40px;background-color: rgb(33, 33, 34);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 30px;padding-left: 30px;line-height: 40px;font-size: 16px;\\\"><span>在主机和容器之间复制文件或目录</span></span></h2><div><pre><div style=\\\"--en-codeblock:true;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\"><span>docker <span>cp</span> [源路径] [目标路径]</span><div><span><br/></span></div><div><span>主机 → 容器:</span></div><div><span>docker <span>cp</span> ./myfile.txt my-nginx:/app/</span></div><div><span><br/></span></div><div><span>容器 → 主机:</span></div><div><span>docker <span>cp</span> my-nginx:/app/myfile.txt ./</span></div></div></pre></div><h2 style=\\\"margin-top:30px;margin-bottom:15px;font-weight:bold;color:black;font-size:22px;margin:10px auto;height:40px;background-color:rgb(251,251,251);border-bottom:1px solid rgb(246,246,246);overflow:hidden;box-sizing:border-box\\\"><span style=\\\"margin-left: -10px;display: inline-block;width: auto;height: 40px;background-color: rgb(33, 33, 34);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 30px;padding-left: 30px;line-height: 40px;font-size: 16px;\\\"><span>将一个或多个镜像保存为 tar 文件</span></span></h2><div><pre><div style=\\\"--en-codeblock:true;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\"><span>docker save -o <span>[输出文件]</span> <span>[镜像名称]</span></span></div></pre></div><h2 style=\\\"margin-top:30px;margin-bottom:15px;font-weight:bold;color:black;font-size:22px;margin:10px auto;height:40px;background-color:rgb(251,251,251);border-bottom:1px solid rgb(246,246,246);overflow:hidden;box-sizing:border-box\\\"><span style=\\\"margin-left: -10px;display: inline-block;width: auto;height: 40px;background-color: rgb(33, 33, 34);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 30px;padding-left: 30px;line-height: 40px;font-size: 16px;\\\"><span>从 tar 文件加载镜像</span></span></h2><div><pre><div style=\\\"--en-codeblock:true;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\"><span>docker load -<span>i</span> <span>[输入文件]</span></span></div></pre></div><h2 style=\\\"margin-top:30px;margin-bottom:15px;font-weight:bold;color:black;font-size:22px;margin:10px auto;height:40px;background-color:rgb(251,251,251);border-bottom:1px solid rgb(246,246,246);overflow:hidden;box-sizing:border-box\\\"><span style=\\\"margin-left: -10px;display: inline-block;width: auto;height: 40px;background-color: rgb(33, 33, 34);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 30px;padding-left: 30px;line-height: 40px;font-size: 16px;\\\"><span>将容器的当前状态保存为一个新镜像</span></span></h2><div><pre><div style=\\\"--en-codeblock:true;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\"><span><span>#</span><span># 启动一个容器</span></span><div><span>docker run -it [镜像名称] /bin/bash</span></div><div><span><br/></span></div><div><span>#<span># 安装vim 然后进行修改代码</span></span></div><div><span>apt update &amp;&amp; apt install -y vim</span></div><div><span><br/></span></div><div><span>#<span># 将一个容器的当前状态保存为一个新的镜像</span></span></div><div><span>docker commit [运行的容器ID] [新的镜像名称]</span></div></div></pre></div><h2 style=\\\"margin-top:30px;margin-bottom:15px;font-weight:bold;color:black;font-size:22px;margin:10px auto;height:40px;background-color:rgb(251,251,251);border-bottom:1px solid rgb(246,246,246);overflow:hidden;box-sizing:border-box\\\"><span style=\\\"margin-left: -10px;display: inline-block;width: auto;height: 40px;background-color: rgb(33, 33, 34);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 30px;padding-left: 30px;line-height: 40px;font-size: 16px;\\\"><span>停止并删除所有容器</span></span></h2><div><pre><div style=\\\"--en-codeblock:true;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\"><span>docker stop <span>$</span>(docker <span>ps</span> <span>-aq</span>) &amp;&amp; docker <span>rm</span> <span>$</span>(docker <span>ps</span> <span>-aq</span>)</span></div></pre></div><h2 style=\\\"margin-top:30px;margin-bottom:15px;font-weight:bold;color:black;font-size:22px;margin:10px auto;height:40px;background-color:rgb(251,251,251);border-bottom:1px solid rgb(246,246,246);overflow:hidden;box-sizing:border-box\\\"><span style=\\\"margin-left: -10px;display: inline-block;width: auto;height: 40px;background-color: rgb(33, 33, 34);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 30px;padding-left: 30px;line-height: 40px;font-size: 16px;\\\"><span>删除所有未使用的镜像</span></span></h2><div><pre><div style=\\\"--en-codeblock:true;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\"><span>docker rmi $(docker images -q)</span></div></pre></div><h2 style=\\\"margin-top:30px;margin-bottom:15px;font-weight:bold;color:black;font-size:22px;margin:10px auto;height:40px;background-color:rgb(251,251,251);border-bottom:1px solid rgb(246,246,246);overflow:hidden;box-sizing:border-box\\\"><span style=\\\"margin-left: -10px;display: inline-block;width: auto;height: 40px;background-color: rgb(33, 33, 34);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 30px;padding-left: 30px;line-height: 40px;font-size: 16px;\\\"><span>提取镜像的目录到本地</span></span></h2><div><pre><div style=\\\"--en-codeblock:true;--en-meta:{&quot;title&quot;:&quot;&quot;,&quot;lang&quot;:&quot;Plain Text&quot;,&quot;theme&quot;:&quot;default&quot;,&quot;showLine&quot;:true,&quot;lineWrap&quot;:true};box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.14902); background-position: initial initial; background-repeat: initial initial; margin-top: 6px;\\\"><span><span># 1. 创建临时容器（不启动）</span></span><div><span>docker create --name temp_container [当前镜像的ID]</span></div><div><span><br/></span></div><div><span><span># 2. 只提取 /src 目录到主机当前目录下的 src_files 文件夹</span></span></div><div><span>docker <span>cp</span> temp_container:/src ./src_files</span></div><div><span><br/></span></div><div><span><span># 3. 删除临时容器</span></span></div><div><span>docker <span>rm</span> -f temp_container</span></div></div></pre></div></div><div style=\\\"width:100%;font-size:18px;height:40px;line-height:40px;text-align:left;\\\"><strong><strong><span><br/></span></strong></strong></div><div style=\\\"margin: 10px auto;letter-spacing: 1px;\\\"><div style=\\\"width: 100%;font-size: 18px;height: 40px;line-height: 40px;border-bottom: 2px solid rgb(30, 28, 28);text-align: left;\\\"><strong><strong><strong><span>四、 总结</span></strong></strong></strong></div></div></div><div style=\\\"font-size: 16px;color: black;padding: 25px 30px;line-height: 1.6;letter-spacing: 1px;word-break: break-word;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &quot;PingFang SC&quot;, Cambria, Cochin, Georgia, Times, &quot;Times New Roman&quot;, serif;margin-top: -10px;\\\"><blockquote style=\\\"font-size: 0.9em;overflow: auto;border-left-color: rgba(0, 0, 0, 0.4);background: rgba(0, 0, 0, 0.05);color: rgb(106, 115, 125);padding: 10px 10px 10px 20px;margin-bottom: 20px;margin-top: 20px;letter-spacing: 1px;\\\"><p style=\\\"margin:0;padding-top:8px;padding-bottom:8px;font-size:17px;word-spacing:3px;letter-spacing:1px;color:black;line-height:26px\\\"><span><span style=\\\"font-size: 14px;\\\">以上是 Docker 的常用命令及其详细用法，涵盖了镜像管理、容器操作、网络配置和存储管理以及常用命令等方面。通过熟练掌握这些命令，你可以轻松构建、运行和管理容器化应用。建议在实际操作中多加练习，并结合官方文档（docker help 或 Docker 官网）深入学习。</span></span></p></blockquote><span>如果你有特定场景或问题，欢迎留言讨论！希望这篇文章对你有所帮助！</span></div></div></div><div><div><div><div style=\\\"display:flex;color:rgba(0,0,0,.3);\\\"><div style=\\\"color:rgba(0,0,0,.3);\\\">个人观点，仅供参考</div></div></div></div></div></div></div></div></span>\\\n</div></body></html>\\u0000\"]],\"start1\":0,\"start2\":0,\"length1\":0,\"length2\":55828}]"
metadata_diff: {"new":{"id":"78fc832476bf46f8bf6d4fb9bac580ac","parent_id":"f67288c3a0be4374b5d532b5dcc3aabc","latitude":"0.00000000","longitude":"0.00000000","altitude":"0.0000","author":"","source_url":"","is_todo":0,"todo_due":0,"todo_completed":0,"source":"joplin-desktop","source_application":"net.cozic.joplin-desktop","application_data":"","order":1764348818382,"markup_language":2,"is_shared":0,"share_id":"","conflict_original_id":"","master_key_id":"","user_data":"","deleted_time":0},"deleted":[]}
encryption_cipher_text: 
encryption_applied: 0
updated_time: 2025-11-28T21:03:25.224Z
created_time: 2025-11-28T21:03:25.224Z
type_: 13