id: 65f1c99894b347e0bb757ef5690c85ba
parent_id: 
item_type: 1
item_id: bd36c5b5bb54467d9d85098fb5d71b50
item_updated_time: 1764345613795
title_diff: "[{\"diffs\":[[1,\"Docker入门系列——Docker-Compose\"]],\"start1\":0,\"start2\":0,\"length1\":0,\"length2\":26}]"
body_diff: "[{\"diffs\":[[1,\"<html>\\\r\\\n<head>\\\r\\\n  <title>Docker入门系列——Docker-Compose</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=\\\"35264\\\"></a>\\\r\\\n<h1>Docker入门系列——Docker-Compose</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=Mzk0NjY0MTc0NA==&amp;mid=2247485511&amp;idx=1&amp;sn=095394b1580db5a8de51c0285e90f96d&amp;chksm=c2fc8d96e551edac0959cd70c747890c8bed0144ea178cd3d7fadd7c07af7438d605874e4795&amp;mpshare=1&amp;scene=1&amp;srcid=1230SaUtmxC6v7QVvpkDFo9b&amp;sharer_shareinfo=455e4ecc110cd94275ac088921caed77&amp;sharer_shareinfo_first=455e4ecc110cd94275ac088921caed77#rd\\\"><span>http://mp.weixin.qq.com/s?__biz=Mzk0NjY0MTc0NA==&amp;mid=2247485...</span></a></div></div>\\\n<p></p>\\\n<div><span></span></div>\\\n<div style=\\\"-webkit-tap-highlight-color:transparent;\\\"><div style=\\\"-webkit-tap-highlight-color:transparent;\\\"><div style=\\\"-webkit-tap-highlight-color:transparent;\\\"><h1 style=\\\"-webkit-tap-highlight-color:transparent;margin:0\\\"> Docker入门系列——Docker-Compose </h1><div style=\\\"-webkit-tap-highlight-color:transparent;\\\"><span style=\\\"-webkit-tap-highlight-color:transparent;position:relative\\\">原创</span><span style=\\\"-webkit-tap-highlight-color:transparent\\\"> 一叶扁舟 </span><span style=\\\"-webkit-tap-highlight-color:transparent\\\"><a style=\\\"-webkit-tap-highlight-color:transparent;position:relative\\\"> 代码麻辣烫 </a></span><span style=\\\"-webkit-tap-highlight-color:transparent\\\"><em style=\\\"-webkit-tap-highlight-color:transparent\\\"></em></span></div><div style=\\\"-webkit-tap-highlight-color:transparent;\\\"><div style=\\\"-webkit-tap-highlight-color:transparent;margin-bottom:0;padding-left:10px;padding-right:10px;background-attachment:scroll;background-clip:border-box;background-image:linear-gradient(90deg,rgba(50,0,0,0.03) 0,rgba(255,255,255,0) 11.49%),linear-gradient(360deg,rgba(50,0,0,0.04) 0,rgba(255,255,255,0) 12.16%);background-origin:padding-box;background-position:0 0;background-repeat:repeat,repeat;background-size:20px 20px,20px 20px;width:auto;font-family:Optima,PingFangSC-light,serif;font-size:16px;color:rgb(0,0,0);line-height:1.5em;word-spacing:0;letter-spacing:0;word-break:break-word;text-align:left;\\\"><div style=\\\"-webkit-tap-highlight-color:transparent;margin-top:10px;margin-bottom:10px;display:flex;flex-direction:column;justify-content:center;align-items:center;\\\"><img src=\\\":/fa09aba4cec14202a6103c741794a15b\\\" type=\\\"image/png\\\" data-filename=\\\"640.png\\\" style=\\\"--en-marks:%7B%22align%22%3A%22center%22%7D;-webkit-tap-highlight-color:transparent;display:block;margin-right:auto;margin-left:auto;border-style:none;border-width:3px;border-color:rgba(0,0,0,0.4);border-radius:8px;object-fit:fill;box-shadow:rgb(153,153,153) 2px 4px 8px 0;height:auto !important\\\"/></div><p style=\\\"-webkit-tap-highlight-color:transparent;margin:0;color:rgb(43,43,43);font-size:14px;line-height:1.8em;letter-spacing:0.02em;text-indent:0;padding-top:8px;padding-bottom:8px\\\">Docker Compose 是 Docker 官方编排工具，用于定义和运行多容器 Docker 应用程序。它是一个轻量级的工具，用于快速配置和启动应用程序的不同服务。</p><h2 style=\\\"-webkit-tap-highlight-color:transparent;margin:0;border-color:rgb(0,0,0) rgb(0,0,0) rgb(64,184,250);margin-top:30px;margin-bottom:15px;align-items:unset;background-attachment:scroll;background-clip:border-box;background-image:none;background-origin:padding-box;background-position:0 0;background-repeat:no-repeat;background-size:auto;border-style:none none solid;border-width:1px 1px 4px;border-radius:0;box-shadow:none;flex-direction:unset;float:unset;height:auto;justify-content:unset;line-height:1.5em;overflow:unset;text-shadow:none;transform:none;width:auto;-webkit-box-reflect:unset\\\"><span style=\\\"-webkit-tap-highlight-color:transparent;background-attachment:scroll;background-clip:border-box;background-image:url(https://mmbiz.qpic.cn/sz_mmbiz_png/bA6ibvWzutIZ9bsn4KA0zENgIvE8W3SPI57T6e96Q1fe42BWVgCn2oianXgfh0drrlXK68N1tPUAeHA6o5VtGbSw/640?wx_fmt=png&amp;from=appmsg);background-origin:padding-box;background-position:0 0;background-repeat:no-repeat;background-size:20px 20px;width:20px;height:20px;align-items:unset;border-style:none;border-width:1px;border-color:rgb(0,0,0);border-radius:0;box-shadow:none;display:flex;font-size:22px;font-weight:bold;flex-direction:unset;float:unset;justify-content:unset;letter-spacing:0;line-height:1.5em;margin-bottom:-25px;overflow:unset;text-indent:0;text-shadow:none;transform:none;-webkit-box-reflect:unset\\\"></span><span style=\\\"-webkit-tap-highlight-color:transparent;font-size:20px;color:rgb(64,184,250);line-height:1.5em;letter-spacing:0;align-items:unset;background-attachment:scroll;background-clip:border-box;background-image:none;background-origin:padding-box;background-position:0 0;background-repeat:no-repeat;background-size:auto;border-style:none;border-width:1px;border-color:rgb(0,0,0);border-radius:0;box-shadow:none;display:flex;font-weight:bold;flex-direction:unset;float:unset;height:auto;justify-content:unset;margin-left:25px;overflow:unset;text-indent:0;text-shadow:none;transform:none;width:auto;-webkit-box-reflect:unset\\\">Docker Compose 是什么</span><span style=\\\"-webkit-tap-highlight-color:transparent;background:none 0 0/auto no-repeat scroll padding-box border-box rgba(64,184,250,0.5);align-items:unset;border-style:none;border-width:1px;border-color:rgb(0,0,0);border-radius:20px 0 0;box-shadow:none;display:flex;font-size:22px;font-weight:bold;flex-direction:unset;float:right;height:10px;justify-content:unset;letter-spacing:0;line-height:1.5em;margin-top:-10px;overflow:unset;text-indent:0;text-shadow:none;transform:none;width:200px;-webkit-box-reflect:unset\\\"></span></h2><p style=\\\"-webkit-tap-highlight-color:transparent;margin:0;color:rgb(43,43,43);font-size:14px;line-height:1.8em;letter-spacing:0.02em;text-indent:0;padding-top:8px;padding-bottom:8px\\\">Docker Compose 最初是由 Docker 公司开发，并于 2014 年 6 月首次发布。它的前身是一个名为 <code style=\\\"-webkit-tap-highlight-color:transparent;color:rgb(53,148,247);line-height:1.8em;letter-spacing:0;background:none 0 0/auto no-repeat scroll padding-box border-box rgba(27,31,35,0.05);width:auto;height:auto;margin-left:2px;margin-right:2px;padding:2px 4px;border-style:none;border-width:3px;border-color:rgb(0,0,0) rgba(0,0,0,0.4) rgba(0,0,0,0.4);border-radius:4px;font-family:&quot;Operator Mono&quot;,Consolas,Monaco,Menlo,monospace;word-break:break-all\\\">fig</code> 的开源项目，由 Piston Cloud Computing 开发。Docker 公司看到了 <code style=\\\"-webkit-tap-highlight-color:transparent;color:rgb(53,148,247);line-height:1.8em;letter-spacing:0;background:none 0 0/auto no-repeat scroll padding-box border-box rgba(27,31,35,0.05);width:auto;height:auto;margin-left:2px;margin-right:2px;padding:2px 4px;border-style:none;border-width:3px;border-color:rgb(0,0,0) rgba(0,0,0,0.4) rgba(0,0,0,0.4);border-radius:4px;font-family:&quot;Operator Mono&quot;,Consolas,Monaco,Menlo,monospace;word-break:break-all\\\">fig</code> 的潜力，并决定将其集成到 Docker 生态系统中，从而诞生了 Docker Compose。Docker Compose 的设计目标是简化多容器应用程序的部署和管理，让用户能够通过一个简单的 YAML 文件来定义和管理整个应用程序。</p><p style=\\\"-webkit-tap-highlight-color:transparent;margin:0;color:rgb(43,43,43);font-size:14px;line-height:1.8em;letter-spacing:0.02em;text-indent:0;padding-top:8px;padding-bottom:8px\\\">这使得开发、测试和生产环境的一致性得以保证，同时也简化了应用程序的部署和管理过程。</p><p style=\\\"-webkit-tap-highlight-color:transparent;margin:0;color:rgb(43,43,43);font-size:14px;line-height:1.8em;letter-spacing:0.02em;text-indent:0;padding-top:8px;padding-bottom:8px\\\">Docker Compose 随着 Docker 的发展经历了多个版本的迭代。以下是一些重要的版本更新：</p><ul style=\\\"-webkit-tap-highlight-color:transparent;margin:0;margin-top:8px;margin-bottom:8px;padding-left:25px\\\"><li style=\\\"-webkit-tap-highlight-color:transparent\\\"><div style=\\\"-webkit-tap-highlight-color:transparent;margin-top:5px;margin-bottom:5px;color:rgb(89,89,89);font-size:14px;line-height:1.8em;letter-spacing:0.02em;\\\"><strong style=\\\"-webkit-tap-highlight-color:transparent;color:rgb(53,148,247);background-attachment:scroll;background-clip:border-box;background-image:none;background-origin:padding-box;background-position:0 0;background-repeat:no-repeat;background-size:auto;width:auto;height:auto;border-style:none;border-width:3px;border-color:rgba(0,0,0,0.4);border-radius:0\\\">1.x 版本</strong>：最初的版本，提供了基本的编排功能。</div></li><li style=\\\"-webkit-tap-highlight-color:transparent\\\"><div style=\\\"-webkit-tap-highlight-color:transparent;margin-top:5px;margin-bottom:5px;color:rgb(89,89,89);font-size:14px;line-height:1.8em;letter-spacing:0.02em;\\\"><strong style=\\\"-webkit-tap-highlight-color:transparent;color:rgb(53,148,247);background-attachment:scroll;background-clip:border-box;background-image:none;background-origin:padding-box;background-position:0 0;background-repeat:no-repeat;background-size:auto;width:auto;height:auto;border-style:none;border-width:3px;border-color:rgba(0,0,0,0.4);border-radius:0\\\">2.x 版本</strong>：引入了对 Docker Engine API 的支持，允许更紧密地与 Docker Engine 集成。</div></li><li style=\\\"-webkit-tap-highlight-color:transparent\\\"><div style=\\\"-webkit-tap-highlight-color:transparent;margin-top:5px;margin-bottom:5px;color:rgb(89,89,89);font-size:14px;line-height:1.8em;letter-spacing:0.02em;\\\"><strong style=\\\"-webkit-tap-highlight-color:transparent;color:rgb(53,148,247);background-attachment:scroll;background-clip:border-box;background-image:none;background-origin:padding-box;background-position:0 0;background-repeat:no-repeat;background-size:auto;width:auto;height:auto;border-style:none;border-width:3px;border-color:rgba(0,0,0,0.4);border-radius:0\\\">3.x 版本</strong>：引入了对服务依赖性的支持，允许定义服务之间的启动顺序。</div></li><li style=\\\"-webkit-tap-highlight-color:transparent\\\"><div style=\\\"-webkit-tap-highlight-color:transparent;margin-top:5px;margin-bottom:5px;color:rgb(89,89,89);font-size:14px;line-height:1.8em;letter-spacing:0.02em;\\\"><strong style=\\\"-webkit-tap-highlight-color:transparent;color:rgb(53,148,247);background-attachment:scroll;background-clip:border-box;background-image:none;background-origin:padding-box;background-position:0 0;background-repeat:no-repeat;background-size:auto;width:auto;height:auto;border-style:none;border-width:3px;border-color:rgba(0,0,0,0.4);border-radius:0\\\">4.x 版本</strong>：引入了对环境变量和命令行参数的支持，使得配置更加灵活。</div></li><li style=\\\"-webkit-tap-highlight-color:transparent\\\"><div style=\\\"-webkit-tap-highlight-color:transparent;margin-top:5px;margin-bottom:5px;color:rgb(89,89,89);font-size:14px;line-height:1.8em;letter-spacing:0.02em;\\\"><strong style=\\\"-webkit-tap-highlight-color:transparent;color:rgb(53,148,247);background-attachment:scroll;background-clip:border-box;background-image:none;background-origin:padding-box;background-position:0 0;background-repeat:no-repeat;background-size:auto;width:auto;height:auto;border-style:none;border-width:3px;border-color:rgba(0,0,0,0.4);border-radius:0\\\">5.x 版本</strong>：引入了对 Docker Stacks 的支持，允许在 Docker Swarm 模式下部署应用程序。</div></li></ul><h2 style=\\\"-webkit-tap-highlight-color:transparent;margin:0;border-color:rgb(0,0,0) rgb(0,0,0) rgb(64,184,250);margin-top:30px;margin-bottom:15px;align-items:unset;background-attachment:scroll;background-clip:border-box;background-image:none;background-origin:padding-box;background-position:0 0;background-repeat:no-repeat;background-size:auto;border-style:none none solid;border-width:1px 1px 4px;border-radius:0;box-shadow:none;flex-direction:unset;float:unset;height:auto;justify-content:unset;line-height:1.5em;overflow:unset;text-shadow:none;transform:none;width:auto;-webkit-box-reflect:unset\\\"><span style=\\\"-webkit-tap-highlight-color:transparent;background-attachment:scroll;background-clip:border-box;background-image:url(https://mmbiz.qpic.cn/sz_mmbiz_png/bA6ibvWzutIZ9bsn4KA0zENgIvE8W3SPI57T6e96Q1fe42BWVgCn2oianXgfh0drrlXK68N1tPUAeHA6o5VtGbSw/640?wx_fmt=png&amp;from=appmsg);background-origin:padding-box;background-position:0 0;background-repeat:no-repeat;background-size:20px 20px;width:20px;height:20px;align-items:unset;border-style:none;border-width:1px;border-color:rgb(0,0,0);border-radius:0;box-shadow:none;display:flex;font-size:22px;font-weight:bold;flex-direction:unset;float:unset;justify-content:unset;letter-spacing:0;line-height:1.5em;margin-bottom:-25px;overflow:unset;text-indent:0;text-shadow:none;transform:none;-webkit-box-reflect:unset\\\"></span><span style=\\\"-webkit-tap-highlight-color:transparent;font-size:20px;color:rgb(64,184,250);line-height:1.5em;letter-spacing:0;align-items:unset;background-attachment:scroll;background-clip:border-box;background-image:none;background-origin:padding-box;background-position:0 0;background-repeat:no-repeat;background-size:auto;border-style:none;border-width:1px;border-color:rgb(0,0,0);border-radius:0;box-shadow:none;display:flex;font-weight:bold;flex-direction:unset;float:unset;height:auto;justify-content:unset;margin-left:25px;overflow:unset;text-indent:0;text-shadow:none;transform:none;width:auto;-webkit-box-reflect:unset\\\">Docker Compose 使用方式</span><span style=\\\"-webkit-tap-highlight-color:transparent;background:none 0 0/auto no-repeat scroll padding-box border-box rgba(64,184,250,0.5);align-items:unset;border-style:none;border-width:1px;border-color:rgb(0,0,0);border-radius:20px 0 0;box-shadow:none;display:flex;font-size:22px;font-weight:bold;flex-direction:unset;float:right;height:10px;justify-content:unset;letter-spacing:0;line-height:1.5em;margin-top:-10px;overflow:unset;text-indent:0;text-shadow:none;transform:none;width:200px;-webkit-box-reflect:unset\\\"></span></h2><h3 style=\\\"-webkit-tap-highlight-color:transparent;margin:0;margin-top:30px;margin-bottom:15px;border-style:none;border-width:1px;border-color:rgb(0,0,0);border-radius:0;background-attachment:scroll;background-clip:border-box;background-image:url(https://mmbiz.qpic.cn/sz_mmbiz_png/bA6ibvWzutIZ9bsn4KA0zENgIvE8W3SPINHd3WibA9mmHxdWN7qeElUvu60Spja1VqamYw9wr5ooc6OZ1JbWveAA/640?wx_fmt=png&amp;from=appmsg);background-origin:padding-box;background-position:50% 50%;background-repeat:no-repeat;background-size:30px 30px;width:auto;height:auto;align-items:unset;box-shadow:none;display:flex;flex-direction:unset;float:unset;justify-content:center;line-height:1.5em;overflow:unset;text-shadow:none;transform:none;-webkit-box-reflect:unset\\\"><span style=\\\"-webkit-tap-highlight-color:transparent;font-size:18px;color:rgb(43,43,43);line-height:2.4em;letter-spacing:0;margin-top:38px;margin-bottom:10px;align-items:unset;background-attachment:scroll;background-clip:border-box;background-image:none;background-origin:padding-box;background-position:0 0;background-repeat:no-repeat;background-size:auto;border-style:none;border-width:1px;border-color:rgb(0,0,0);border-radius:0;box-shadow:none;display:inline-block;font-weight:bold;flex-direction:unset;float:unset;height:38px;justify-content:unset;overflow:unset;text-align:center;text-indent:0;text-shadow:none;transform:none;width:auto;-webkit-box-reflect:unset\\\">安装 Docker Compose</span></h3><p style=\\\"-webkit-tap-highlight-color:transparent;margin:0;color:rgb(43,43,43);font-size:14px;line-height:1.8em;letter-spacing:0.02em;text-indent:0;padding-top:8px;padding-bottom:8px\\\">在大多数系统上，Docker Compose 可以作为 Python 的包来安装。以下是安装步骤：</p><pre style=\\\"-webkit-tap-highlight-color:transparent;border-radius:5px;box-shadow:rgba(0,0,0,0.55) 0 2px 10px;margin-top:10px;margin-bottom:10px\\\"><span style=\\\"-webkit-tap-highlight-color:transparent;display:block;background:url(https://mmbiz.qpic.cn/mmbiz_svg/eHEMOF2hOelPPWBYXFCk1mBh0l4uqwPblDl2WDokTnYLrRFRuOj9NEeic1AWibCdOkUHurEaziadDsiaYqCFMFhhSdibPsI4GznJv/640?wx_fmt=svg&amp;from=appmsg) 10px 10px/40px no-repeat rgb(40,44,52);height:30px;width:100%;margin-bottom:-7px;border-radius:5px\\\"></span><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 style=\\\"-webkit-tap-highlight-color:transparent;color:#5c6370;font-style:italic;line-height:26px\\\"># 安装pip（Python的包管理工具）</span><br style=\\\"-webkit-tap-highlight-color:transparent\\\"/>curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py<br style=\\\"-webkit-tap-highlight-color:transparent\\\"/>python get-pip.py<br style=\\\"-webkit-tap-highlight-color:transparent\\\"/><br style=\\\"-webkit-tap-highlight-color:transparent\\\"/><span style=\\\"-webkit-tap-highlight-color:transparent;color:#5c6370;font-style:italic;line-height:26px\\\"># 使用pip安装Docker Compose</span><br style=\\\"-webkit-tap-highlight-color:transparent\\\"/>pip install docker-compose<br style=\\\"-webkit-tap-highlight-color:transparent\\\"/></div></pre><h3 style=\\\"-webkit-tap-highlight-color:transparent;margin:0;margin-top:30px;margin-bottom:15px;border-style:none;border-width:1px;border-color:rgb(0,0,0);border-radius:0;background-attachment:scroll;background-clip:border-box;background-image:url(https://mmbiz.qpic.cn/sz_mmbiz_png/bA6ibvWzutIZ9bsn4KA0zENgIvE8W3SPINHd3WibA9mmHxdWN7qeElUvu60Spja1VqamYw9wr5ooc6OZ1JbWveAA/640?wx_fmt=png&amp;from=appmsg);background-origin:padding-box;background-position:50% 50%;background-repeat:no-repeat;background-size:30px 30px;width:auto;height:auto;align-items:unset;box-shadow:none;display:flex;flex-direction:unset;float:unset;justify-content:center;line-height:1.5em;overflow:unset;text-shadow:none;transform:none;-webkit-box-reflect:unset\\\"><span style=\\\"-webkit-tap-highlight-color:transparent;font-size:18px;color:rgb(43,43,43);line-height:2.4em;letter-spacing:0;margin-top:38px;margin-bottom:10px;align-items:unset;background-attachment:scroll;background-clip:border-box;background-image:none;background-origin:padding-box;background-position:0 0;background-repeat:no-repeat;background-size:auto;border-style:none;border-width:1px;border-color:rgb(0,0,0);border-radius:0;box-shadow:none;display:inline-block;font-weight:bold;flex-direction:unset;float:unset;height:38px;justify-content:unset;overflow:unset;text-align:center;text-indent:0;text-shadow:none;transform:none;width:auto;-webkit-box-reflect:unset\\\">定义服务</span></h3><p style=\\\"-webkit-tap-highlight-color:transparent;margin:0;color:rgb(43,43,43);font-size:14px;line-height:1.8em;letter-spacing:0.02em;text-indent:0;padding-top:8px;padding-bottom:8px\\\">创建一个名为 <code style=\\\"-webkit-tap-highlight-color:transparent;color:rgb(53,148,247);line-height:1.8em;letter-spacing:0;background:none 0 0/auto no-repeat scroll padding-box border-box rgba(27,31,35,0.05);width:auto;height:auto;margin-left:2px;margin-right:2px;padding:2px 4px;border-style:none;border-width:3px;border-color:rgb(0,0,0) rgba(0,0,0,0.4) rgba(0,0,0,0.4);border-radius:4px;font-family:&quot;Operator Mono&quot;,Consolas,Monaco,Menlo,monospace;word-break:break-all\\\">docker-compose.yml</code> 的 YAML 文件来定义服务。以下是一个基本的 <code style=\\\"-webkit-tap-highlight-color:transparent;color:rgb(53,148,247);line-height:1.8em;letter-spacing:0;background:none 0 0/auto no-repeat scroll padding-box border-box rgba(27,31,35,0.05);width:auto;height:auto;margin-left:2px;margin-right:2px;padding:2px 4px;border-style:none;border-width:3px;border-color:rgb(0,0,0) rgba(0,0,0,0.4) rgba(0,0,0,0.4);border-radius:4px;font-family:&quot;Operator Mono&quot;,Consolas,Monaco,Menlo,monospace;word-break:break-all\\\">docker-compose.yml</code> 文件示例：</p><pre style=\\\"-webkit-tap-highlight-color:transparent;border-radius:5px;box-shadow:rgba(0,0,0,0.55) 0 2px 10px;margin-top:10px;margin-bottom:10px\\\"><span style=\\\"-webkit-tap-highlight-color:transparent;display:block;background:url(https://mmbiz.qpic.cn/mmbiz_svg/eHEMOF2hOelPPWBYXFCk1mBh0l4uqwPblDl2WDokTnYLrRFRuOj9NEeic1AWibCdOkUHurEaziadDsiaYqCFMFhhSdibPsI4GznJv/640?wx_fmt=svg&amp;from=appmsg) 10px 10px/40px no-repeat rgb(40,44,52);height:30px;width:100%;margin-bottom:-7px;border-radius:5px\\\"></span><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 style=\\\"-webkit-tap-highlight-color:transparent;color:#d19a66;line-height:26px\\\">version:</span> <span style=\\\"-webkit-tap-highlight-color:transparent;color:#98c379;line-height:26px\\\">'3'</span><br style=\\\"-webkit-tap-highlight-color:transparent\\\"/><span style=\\\"-webkit-tap-highlight-color:transparent;color:#d19a66;line-height:26px\\\">services:</span><br style=\\\"-webkit-tap-highlight-color:transparent\\\"/>  <span style=\\\"-webkit-tap-highlight-color:transparent;color:#d19a66;line-height:26px\\\">web:</span><br style=\\\"-webkit-tap-highlight-color:transparent\\\"/>    <span style=\\\"-webkit-tap-highlight-color:transparent;color:#d19a66;line-height:26px\\\">image:</span> <span style=\\\"-webkit-tap-highlight-color:transparent;color:#98c379;line-height:26px\\\">&quot;nginx:alpine&quot;</span><br style=\\\"-webkit-tap-highlight-color:transparent\\\"/>    <span style=\\\"-webkit-tap-highlight-color:transparent;color:#d19a66;line-height:26px\\\">ports:</span><br style=\\\"-webkit-tap-highlight-color:transparent\\\"/>      <span style=\\\"-webkit-tap-highlight-color:transparent;color:#61aeee;line-height:26px\\\">-</span> <span style=\\\"-webkit-tap-highlight-color:transparent;color:#98c379;line-height:26px\\\">&quot;80:80&quot;</span><br style=\\\"-webkit-tap-highlight-color:transparent\\\"/>    <span style=\\\"-webkit-tap-highlight-color:transparent;color:#d19a66;line-height:26px\\\">volumes:</span><br style=\\\"-webkit-tap-highlight-color:transparent\\\"/>      <span style=\\\"-webkit-tap-highlight-color:transparent;color:#61aeee;line-height:26px\\\">-</span> <span style=\\\"-webkit-tap-highlight-color:transparent;color:#98c379;line-height:26px\\\">&quot;web-data:/var/www&quot;</span><br style=\\\"-webkit-tap-highlight-color:transparent\\\"/>  <span style=\\\"-webkit-tap-highlight-color:transparent;color:#d19a66;line-height:26px\\\">database:</span><br style=\\\"-webkit-tap-highlight-color:transparent\\\"/>    <span style=\\\"-webkit-tap-highlight-color:transparent;color:#d19a66;line-height:26px\\\">image:</span> <span style=\\\"-webkit-tap-highlight-color:transparent;color:#98c379;line-height:26px\\\">&quot;postgres:latest&quot;</span><br style=\\\"-webkit-tap-highlight-color:transparent\\\"/>    <span style=\\\"-webkit-tap-highlight-color:transparent;color:#d19a66;line-height:26px\\\">volumes:</span><br style=\\\"-webkit-tap-highlight-color:transparent\\\"/>      <span style=\\\"-webkit-tap-highlight-color:transparent;color:#61aeee;line-height:26px\\\">-</span> <span style=\\\"-webkit-tap-highlight-color:transparent;color:#98c379;line-height:26px\\\">&quot;db-data:/var/lib/postgresql/data&quot;</span><br style=\\\"-webkit-tap-highlight-color:transparent\\\"/><br style=\\\"-webkit-tap-highlight-color:transparent\\\"/><span style=\\\"-webkit-tap-highlight-color:transparent;color:#d19a66;line-height:26px\\\">volumes:</span><br style=\\\"-webkit-tap-highlight-color:transparent\\\"/>  <span style=\\\"-webkit-tap-highlight-color:transparent;color:#d19a66;line-height:26px\\\">web-data:</span><br style=\\\"-webkit-tap-highlight-color:transparent\\\"/>  <span style=\\\"-webkit-tap-highlight-color:transparent;color:#d19a66;line-height:26px\\\">db-data:</span><br style=\\\"-webkit-tap-highlight-color:transparent\\\"/></div></pre><p style=\\\"-webkit-tap-highlight-color:transparent;margin:0;color:rgb(43,43,43);font-size:14px;line-height:1.8em;letter-spacing:0.02em;text-indent:0;padding-top:8px;padding-bottom:8px\\\">在这个示例中，定义了两个服务：<code style=\\\"-webkit-tap-highlight-color:transparent;color:rgb(53,148,247);line-height:1.8em;letter-spacing:0;background:none 0 0/auto no-repeat scroll padding-box border-box rgba(27,31,35,0.05);width:auto;height:auto;margin-left:2px;margin-right:2px;padding:2px 4px;border-style:none;border-width:3px;border-color:rgb(0,0,0) rgba(0,0,0,0.4) rgba(0,0,0,0.4);border-radius:4px;font-family:&quot;Operator Mono&quot;,Consolas,Monaco,Menlo,monospace;word-break:break-all\\\">web</code> 和 <code style=\\\"-webkit-tap-highlight-color:transparent;color:rgb(53,148,247);line-height:1.8em;letter-spacing:0;background:none 0 0/auto no-repeat scroll padding-box border-box rgba(27,31,35,0.05);width:auto;height:auto;margin-left:2px;margin-right:2px;padding:2px 4px;border-style:none;border-width:3px;border-color:rgb(0,0,0) rgba(0,0,0,0.4) rgba(0,0,0,0.4);border-radius:4px;font-family:&quot;Operator Mono&quot;,Consolas,Monaco,Menlo,monospace;word-break:break-all\\\">database</code>。<code style=\\\"-webkit-tap-highlight-color:transparent;color:rgb(53,148,247);line-height:1.8em;letter-spacing:0;background:none 0 0/auto no-repeat scroll padding-box border-box rgba(27,31,35,0.05);width:auto;height:auto;margin-left:2px;margin-right:2px;padding:2px 4px;border-style:none;border-width:3px;border-color:rgb(0,0,0) rgba(0,0,0,0.4) rgba(0,0,0,0.4);border-radius:4px;font-family:&quot;Operator Mono&quot;,Consolas,Monaco,Menlo,monospace;word-break:break-all\\\">web</code> 服务使用 <code style=\\\"-webkit-tap-highlight-color:transparent;color:rgb(53,148,247);line-height:1.8em;letter-spacing:0;background:none 0 0/auto no-repeat scroll padding-box border-box rgba(27,31,35,0.05);width:auto;height:auto;margin-left:2px;margin-right:2px;padding:2px 4px;border-style:none;border-width:3px;border-color:rgb(0,0,0) rgba(0,0,0,0.4) rgba(0,0,0,0.4);border-radius:4px;font-family:&quot;Operator Mono&quot;,Consolas,Monaco,Menlo,monospace;word-break:break-all\\\">nginx:alpine</code> 镜像，并映射端口 80。<code style=\\\"-webkit-tap-highlight-color:transparent;color:rgb(53,148,247);line-height:1.8em;letter-spacing:0;background:none 0 0/auto no-repeat scroll padding-box border-box rgba(27,31,35,0.05);width:auto;height:auto;margin-left:2px;margin-right:2px;padding:2px 4px;border-style:none;border-width:3px;border-color:rgb(0,0,0) rgba(0,0,0,0.4) rgba(0,0,0,0.4);border-radius:4px;font-family:&quot;Operator Mono&quot;,Consolas,Monaco,Menlo,monospace;word-break:break-all\\\">database</code> 服务使用 <code style=\\\"-webkit-tap-highlight-color:transparent;color:rgb(53,148,247);line-height:1.8em;letter-spacing:0;background:none 0 0/auto no-repeat scroll padding-box border-box rgba(27,31,35,0.05);width:auto;height:auto;margin-left:2px;margin-right:2px;padding:2px 4px;border-style:none;border-width:3px;border-color:rgb(0,0,0) rgba(0,0,0,0.4) rgba(0,0,0,0.4);border-radius:4px;font-family:&quot;Operator Mono&quot;,Consolas,Monaco,Menlo,monospace;word-break:break-all\\\">postgres:latest</code> 镜像。</p><h3 style=\\\"-webkit-tap-highlight-color:transparent;margin:0;margin-top:30px;margin-bottom:15px;border-style:none;border-width:1px;border-color:rgb(0,0,0);border-radius:0;background-attachment:scroll;background-clip:border-box;background-image:url(https://mmbiz.qpic.cn/sz_mmbiz_png/bA6ibvWzutIZ9bsn4KA0zENgIvE8W3SPINHd3WibA9mmHxdWN7qeElUvu60Spja1VqamYw9wr5ooc6OZ1JbWveAA/640?wx_fmt=png&amp;from=appmsg);background-origin:padding-box;background-position:50% 50%;background-repeat:no-repeat;background-size:30px 30px;width:auto;height:auto;align-items:unset;box-shadow:none;display:flex;flex-direction:unset;float:unset;justify-content:center;line-height:1.5em;overflow:unset;text-shadow:none;transform:none;-webkit-box-reflect:unset\\\"><span style=\\\"-webkit-tap-highlight-color:transparent;font-size:18px;color:rgb(43,43,43);line-height:2.4em;letter-spacing:0;margin-top:38px;margin-bottom:10px;align-items:unset;background-attachment:scroll;background-clip:border-box;background-image:none;background-origin:padding-box;background-position:0 0;background-repeat:no-repeat;background-size:auto;border-style:none;border-width:1px;border-color:rgb(0,0,0);border-radius:0;box-shadow:none;display:inline-block;font-weight:bold;flex-direction:unset;float:unset;height:38px;justify-content:unset;overflow:unset;text-align:center;text-indent:0;text-shadow:none;transform:none;width:auto;-webkit-box-reflect:unset\\\">常用 CLI 命令</span></h3><p style=\\\"-webkit-tap-highlight-color:transparent;margin:0;color:rgb(43,43,43);font-size:14px;line-height:1.8em;letter-spacing:0.02em;text-indent:0;padding-top:8px;padding-bottom:8px\\\">以下是一些常用的 Docker Compose CLI 命令：</p><ol style=\\\"-webkit-tap-highlight-color:transparent;margin:0;margin-top:8px;margin-bottom:8px;padding-left:25px\\\"><li style=\\\"-webkit-tap-highlight-color:transparent\\\"><div style=\\\"-webkit-tap-highlight-color:transparent;margin-top:5px;margin-bottom:5px;color:rgb(89,89,89);font-size:14px;line-height:1.8em;letter-spacing:0.02em;\\\"><strong style=\\\"-webkit-tap-highlight-color:transparent;color:rgb(53,148,247);background-attachment:scroll;background-clip:border-box;background-image:none;background-origin:padding-box;background-position:0 0;background-repeat:no-repeat;background-size:auto;width:auto;height:auto;border-style:none;border-width:3px;border-color:rgba(0,0,0,0.4);border-radius:0\\\">启动服务</strong>：</div></li></ol><pre style=\\\"-webkit-tap-highlight-color:transparent;border-radius:5px;box-shadow:rgba(0,0,0,0.55) 0 2px 10px;margin-top:10px;margin-bottom:10px\\\"><span style=\\\"-webkit-tap-highlight-color:transparent;display:block;background:url(https://mmbiz.qpic.cn/mmbiz_svg/eHEMOF2hOelPPWBYXFCk1mBh0l4uqwPblDl2WDokTnYLrRFRuOj9NEeic1AWibCdOkUHurEaziadDsiaYqCFMFhhSdibPsI4GznJv/640?wx_fmt=svg&amp;from=appmsg) 10px 10px/40px no-repeat rgb(40,44,52);height:30px;width:100%;margin-bottom:-7px;border-radius:5px\\\"></span><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;\\\">docker-compose up<br style=\\\"-webkit-tap-highlight-color:transparent\\\"/></div></pre><p style=\\\"-webkit-tap-highlight-color:transparent;margin:0;color:rgb(43,43,43);font-size:14px;line-height:1.8em;letter-spacing:0.02em;text-indent:0;padding-top:8px;padding-bottom:8px\\\">这个命令将启动所有服务，并在前台运行。</p><ol start=\\\"2\\\" style=\\\"-webkit-tap-highlight-color:transparent;margin:0;margin-top:8px;margin-bottom:8px;padding-left:25px\\\"><li style=\\\"-webkit-tap-highlight-color:transparent\\\"><div style=\\\"-webkit-tap-highlight-color:transparent;margin-top:5px;margin-bottom:5px;color:rgb(89,89,89);font-size:14px;line-height:1.8em;letter-spacing:0.02em;\\\"><strong style=\\\"-webkit-tap-highlight-color:transparent;color:rgb(53,148,247);background-attachment:scroll;background-clip:border-box;background-image:none;background-origin:padding-box;background-position:0 0;background-repeat:no-repeat;background-size:auto;width:auto;height:auto;border-style:none;border-width:3px;border-color:rgba(0,0,0,0.4);border-radius:0\\\">后台运行服务</strong>：</div></li></ol><pre style=\\\"-webkit-tap-highlight-color:transparent;border-radius:5px;box-shadow:rgba(0,0,0,0.55) 0 2px 10px;margin-top:10px;margin-bottom:10px\\\"><span style=\\\"-webkit-tap-highlight-color:transparent;display:block;background:url(https://mmbiz.qpic.cn/mmbiz_svg/eHEMOF2hOelPPWBYXFCk1mBh0l4uqwPblDl2WDokTnYLrRFRuOj9NEeic1AWibCdOkUHurEaziadDsiaYqCFMFhhSdibPsI4GznJv/640?wx_fmt=svg&amp;from=appmsg) 10px 10px/40px no-repeat rgb(40,44,52);height:30px;width:100%;margin-bottom:-7px;border-radius:5px\\\"></span><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;\\\">docker-compose up -d<br style=\\\"-webkit-tap-highlight-color:transparent\\\"/></div></pre><p style=\\\"-webkit-tap-highlight-color:transparent;margin:0;color:rgb(43,43,43);font-size:14px;line-height:1.8em;letter-spacing:0.02em;text-indent:0;padding-top:8px;padding-bottom:8px\\\">使用 <code style=\\\"-webkit-tap-highlight-color:transparent;color:rgb(53,148,247);line-height:1.8em;letter-spacing:0;background:none 0 0/auto no-repeat scroll padding-box border-box rgba(27,31,35,0.05);width:auto;height:auto;margin-left:2px;margin-right:2px;padding:2px 4px;border-style:none;border-width:3px;border-color:rgb(0,0,0) rgba(0,0,0,0.4) rgba(0,0,0,0.4);border-radius:4px;font-family:&quot;Operator Mono&quot;,Consolas,Monaco,Menlo,monospace;word-break:break-all\\\">-d</code> 标志，服务将在后台运行。</p><ol start=\\\"3\\\" style=\\\"-webkit-tap-highlight-color:transparent;margin:0;margin-top:8px;margin-bottom:8px;padding-left:25px\\\"><li style=\\\"-webkit-tap-highlight-color:transparent\\\"><div style=\\\"-webkit-tap-highlight-color:transparent;margin-top:5px;margin-bottom:5px;color:rgb(89,89,89);font-size:14px;line-height:1.8em;letter-spacing:0.02em;\\\"><strong style=\\\"-webkit-tap-highlight-color:transparent;color:rgb(53,148,247);background-attachment:scroll;background-clip:border-box;background-image:none;background-origin:padding-box;background-position:0 0;background-repeat:no-repeat;background-size:auto;width:auto;height:auto;border-style:none;border-width:3px;border-color:rgba(0,0,0,0.4);border-radius:0\\\">停止服务</strong>：</div></li></ol><pre style=\\\"-webkit-tap-highlight-color:transparent;border-radius:5px;box-shadow:rgba(0,0,0,0.55) 0 2px 10px;margin-top:10px;margin-bottom:10px\\\"><span style=\\\"-webkit-tap-highlight-color:transparent;display:block;background:url(https://mmbiz.qpic.cn/mmbiz_svg/eHEMOF2hOelPPWBYXFCk1mBh0l4uqwPblDl2WDokTnYLrRFRuOj9NEeic1AWibCdOkUHurEaziadDsiaYqCFMFhhSdibPsI4GznJv/640?wx_fmt=svg&amp;from=appmsg) 10px 10px/40px no-repeat rgb(40,44,52);height:30px;width:100%;margin-bottom:-7px;border-radius:5px\\\"></span><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;\\\">docker-compose down<br style=\\\"-webkit-tap-highlight-color:transparent\\\"/></div></pre><p style=\\\"-webkit-tap-highlight-color:transparent;margin:0;color:rgb(43,43,43);font-size:14px;line-height:1.8em;letter-spacing:0.02em;text-indent:0;padding-top:8px;padding-bottom:8px\\\">这个命令将停止所有服务，并移除容器。</p><ol start=\\\"4\\\" style=\\\"-webkit-tap-highlight-color:transparent;margin:0;margin-top:8px;margin-bottom:8px;padding-left:25px\\\"><li style=\\\"-webkit-tap-highlight-color:transparent\\\"><div style=\\\"-webkit-tap-highlight-color:transparent;margin-top:5px;margin-bottom:5px;color:rgb(89,89,89);font-size:14px;line-height:1.8em;letter-spacing:0.02em;\\\"><strong style=\\\"-webkit-tap-highlight-color:transparent;color:rgb(53,148,247);background-attachment:scroll;background-clip:border-box;background-image:none;background-origin:padding-box;background-position:0 0;background-repeat:no-repeat;background-size:auto;width:auto;height:auto;border-style:none;border-width:3px;border-color:rgba(0,0,0,0.4);border-radius:0\\\">查看服务状态</strong>：</div></li></ol><pre style=\\\"-webkit-tap-highlight-color:transparent;border-radius:5px;box-shadow:rgba(0,0,0,0.55) 0 2px 10px;margin-top:10px;margin-bottom:10px\\\"><span style=\\\"-webkit-tap-highlight-color:transparent;display:block;background:url(https://mmbiz.qpic.cn/mmbiz_svg/eHEMOF2hOelPPWBYXFCk1mBh0l4uqwPblDl2WDokTnYLrRFRuOj9NEeic1AWibCdOkUHurEaziadDsiaYqCFMFhhSdibPsI4GznJv/640?wx_fmt=svg&amp;from=appmsg) 10px 10px/40px no-repeat rgb(40,44,52);height:30px;width:100%;margin-bottom:-7px;border-radius:5px\\\"></span><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;\\\">docker-compose ps<br style=\\\"-webkit-tap-highlight-color:transparent\\\"/></div></pre><p style=\\\"-webkit-tap-highlight-color:transparent;margin:0;color:rgb(43,43,43);font-size:14px;line-height:1.8em;letter-spacing:0.02em;text-indent:0;padding-top:8px;padding-bottom:8px\\\">这个命令将列出所有服务的状态。</p><ol start=\\\"5\\\" style=\\\"-webkit-tap-highlight-color:transparent;margin:0;margin-top:8px;margin-bottom:8px;padding-left:25px\\\"><li style=\\\"-webkit-tap-highlight-color:transparent\\\"><div style=\\\"-webkit-tap-highlight-color:transparent;margin-top:5px;margin-bottom:5px;color:rgb(89,89,89);font-size:14px;line-height:1.8em;letter-spacing:0.02em;\\\"><strong style=\\\"-webkit-tap-highlight-color:transparent;color:rgb(53,148,247);background-attachment:scroll;background-clip:border-box;background-image:none;background-origin:padding-box;background-position:0 0;background-repeat:no-repeat;background-size:auto;width:auto;height:auto;border-style:none;border-width:3px;border-color:rgba(0,0,0,0.4);border-radius:0\\\">重建服务</strong>：</div></li></ol><pre style=\\\"-webkit-tap-highlight-color:transparent;border-radius:5px;box-shadow:rgba(0,0,0,0.55) 0 2px 10px;margin-top:10px;margin-bottom:10px\\\"><span style=\\\"-webkit-tap-highlight-color:transparent;display:block;background:url(https://mmbiz.qpic.cn/mmbiz_svg/eHEMOF2hOelPPWBYXFCk1mBh0l4uqwPblDl2WDokTnYLrRFRuOj9NEeic1AWibCdOkUHurEaziadDsiaYqCFMFhhSdibPsI4GznJv/640?wx_fmt=svg&amp;from=appmsg) 10px 10px/40px no-repeat rgb(40,44,52);height:30px;width:100%;margin-bottom:-7px;border-radius:5px\\\"></span><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;\\\">docker-compose up --build<br style=\\\"-webkit-tap-highlight-color:transparent\\\"/></div></pre><p style=\\\"-webkit-tap-highlight-color:transparent;margin:0;color:rgb(43,43,43);font-size:14px;line-height:1.8em;letter-spacing:0.02em;text-indent:0;padding-top:8px;padding-bottom:8px\\\">这个命令将重建服务，并重新创建容器。</p><ol start=\\\"6\\\" style=\\\"-webkit-tap-highlight-color:transparent;margin:0;margin-top:8px;margin-bottom:8px;padding-left:25px\\\"><li style=\\\"-webkit-tap-highlight-color:transparent\\\"><div style=\\\"-webkit-tap-highlight-color:transparent;margin-top:5px;margin-bottom:5px;color:rgb(89,89,89);font-size:14px;line-height:1.8em;letter-spacing:0.02em;\\\"><strong style=\\\"-webkit-tap-highlight-color:transparent;color:rgb(53,148,247);background-attachment:scroll;background-clip:border-box;background-image:none;background-origin:padding-box;background-position:0 0;background-repeat:no-repeat;background-size:auto;width:auto;height:auto;border-style:none;border-width:3px;border-color:rgba(0,0,0,0.4);border-radius:0\\\">查看日志</strong>：</div></li></ol><pre style=\\\"-webkit-tap-highlight-color:transparent;border-radius:5px;box-shadow:rgba(0,0,0,0.55) 0 2px 10px;margin-top:10px;margin-bottom:10px\\\"><span style=\\\"-webkit-tap-highlight-color:transparent;display:block;background:url(https://mmbiz.qpic.cn/mmbiz_svg/eHEMOF2hOelPPWBYXFCk1mBh0l4uqwPblDl2WDokTnYLrRFRuOj9NEeic1AWibCdOkUHurEaziadDsiaYqCFMFhhSdibPsI4GznJv/640?wx_fmt=svg&amp;from=appmsg) 10px 10px/40px no-repeat rgb(40,44,52);height:30px;width:100%;margin-bottom:-7px;border-radius:5px\\\"></span><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;\\\">docker-compose logs<br style=\\\"-webkit-tap-highlight-color:transparent\\\"/></div></pre><p style=\\\"-webkit-tap-highlight-color:transparent;margin:0;color:rgb(43,43,43);font-size:14px;line-height:1.8em;letter-spacing:0.02em;text-indent:0;padding-top:8px;padding-bottom:8px\\\">这个命令将显示所有服务的日志。</p><ol start=\\\"7\\\" style=\\\"-webkit-tap-highlight-color:transparent;margin:0;margin-top:8px;margin-bottom:8px;padding-left:25px\\\"><li style=\\\"-webkit-tap-highlight-color:transparent\\\"><div style=\\\"-webkit-tap-highlight-color:transparent;margin-top:5px;margin-bottom:5px;color:rgb(89,89,89);font-size:14px;line-height:1.8em;letter-spacing:0.02em;\\\"><strong style=\\\"-webkit-tap-highlight-color:transparent;color:rgb(53,148,247);background-attachment:scroll;background-clip:border-box;background-image:none;background-origin:padding-box;background-position:0 0;background-repeat:no-repeat;background-size:auto;width:auto;height:auto;border-style:none;border-width:3px;border-color:rgba(0,0,0,0.4);border-radius:0\\\">进入容器</strong>：</div></li></ol><pre style=\\\"-webkit-tap-highlight-color:transparent;border-radius:5px;box-shadow:rgba(0,0,0,0.55) 0 2px 10px;margin-top:10px;margin-bottom:10px\\\"><span style=\\\"-webkit-tap-highlight-color:transparent;display:block;background:url(https://mmbiz.qpic.cn/mmbiz_svg/eHEMOF2hOelPPWBYXFCk1mBh0l4uqwPblDl2WDokTnYLrRFRuOj9NEeic1AWibCdOkUHurEaziadDsiaYqCFMFhhSdibPsI4GznJv/640?wx_fmt=svg&amp;from=appmsg) 10px 10px/40px no-repeat rgb(40,44,52);height:30px;width:100%;margin-bottom:-7px;border-radius:5px\\\"></span><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;\\\">docker-compose <span style=\\\"-webkit-tap-highlight-color:transparent;color:#e6c07b;line-height:26px\\\">exec</span> [service-name] /bin/bash<br style=\\\"-webkit-tap-highlight-color:transparent\\\"/></div></pre><p style=\\\"-webkit-tap-highlight-color:transparent;margin:0;color:rgb(43,43,43);font-size:14px;line-height:1.8em;letter-spacing:0.02em;text-indent:0;padding-top:8px;padding-bottom:8px\\\">这个命令将进入指定服务的容器，并启动一个 bash 会话。</p><ol start=\\\"8\\\" style=\\\"-webkit-tap-highlight-color:transparent;margin:0;margin-top:8px;margin-bottom:8px;padding-left:25px\\\"><li style=\\\"-webkit-tap-highlight-color:transparent\\\"><div style=\\\"-webkit-tap-highlight-color:transparent;margin-top:5px;margin-bottom:5px;color:rgb(89,89,89);font-size:14px;line-height:1.8em;letter-spacing:0.02em;\\\"><strong style=\\\"-webkit-tap-highlight-color:transparent;color:rgb(53,148,247);background-attachment:scroll;background-clip:border-box;background-image:none;background-origin:padding-box;background-position:0 0;background-repeat:no-repeat;background-size:auto;width:auto;height:auto;border-style:none;border-width:3px;border-color:rgba(0,0,0,0.4);border-radius:0\\\">停止单个服务</strong>：</div></li></ol><pre style=\\\"-webkit-tap-highlight-color:transparent;border-radius:5px;box-shadow:rgba(0,0,0,0.55) 0 2px 10px;margin-top:10px;margin-bottom:10px\\\"><span style=\\\"-webkit-tap-highlight-color:transparent;display:block;background:url(https://mmbiz.qpic.cn/mmbiz_svg/eHEMOF2hOelPPWBYXFCk1mBh0l4uqwPblDl2WDokTnYLrRFRuOj9NEeic1AWibCdOkUHurEaziadDsiaYqCFMFhhSdibPsI4GznJv/640?wx_fmt=svg&amp;from=appmsg) 10px 10px/40px no-repeat rgb(40,44,52);height:30px;width:100%;margin-bottom:-7px;border-radius:5px\\\"></span><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;\\\">docker-compose stop [service-name]<br style=\\\"-webkit-tap-highlight-color:transparent\\\"/></div></pre><p style=\\\"-webkit-tap-highlight-color:transparent;margin:0;color:rgb(43,43,43);font-size:14px;line-height:1.8em;letter-spacing:0.02em;text-indent:0;padding-top:8px;padding-bottom:8px\\\">这个命令将停止指定的服务。</p><ol start=\\\"9\\\" style=\\\"-webkit-tap-highlight-color:transparent;margin:0;margin-top:8px;margin-bottom:8px;padding-left:25px\\\"><li style=\\\"-webkit-tap-highlight-color:transparent\\\"><div style=\\\"-webkit-tap-highlight-color:transparent;margin-top:5px;margin-bottom:5px;color:rgb(89,89,89);font-size:14px;line-height:1.8em;letter-spacing:0.02em;\\\"><strong style=\\\"-webkit-tap-highlight-color:transparent;color:rgb(53,148,247);background-attachment:scroll;background-clip:border-box;background-image:none;background-origin:padding-box;background-position:0 0;background-repeat:no-repeat;background-size:auto;width:auto;height:auto;border-style:none;border-width:3px;border-color:rgba(0,0,0,0.4);border-radius:0\\\">启动单个服务</strong>：</div></li></ol><pre style=\\\"-webkit-tap-highlight-color:transparent;border-radius:5px;box-shadow:rgba(0,0,0,0.55) 0 2px 10px;margin-top:10px;margin-bottom:10px\\\"><span style=\\\"-webkit-tap-highlight-color:transparent;display:block;background:url(https://mmbiz.qpic.cn/mmbiz_svg/eHEMOF2hOelPPWBYXFCk1mBh0l4uqwPblDl2WDokTnYLrRFRuOj9NEeic1AWibCdOkUHurEaziadDsiaYqCFMFhhSdibPsI4GznJv/640?wx_fmt=svg&amp;from=appmsg) 10px 10px/40px no-repeat rgb(40,44,52);height:30px;width:100%;margin-bottom:-7px;border-radius:5px\\\"></span><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;\\\">docker-compose start [service-name]<br style=\\\"-webkit-tap-highlight-color:transparent\\\"/></div></pre><p style=\\\"-webkit-tap-highlight-color:transparent;margin:0;color:rgb(43,43,43);font-size:14px;line-height:1.8em;letter-spacing:0.02em;text-indent:0;padding-top:8px;padding-bottom:8px\\\">这个命令将启动指定的服务。</p><ol start=\\\"10\\\" style=\\\"-webkit-tap-highlight-color:transparent;margin:0;margin-top:8px;margin-bottom:8px;padding-left:25px\\\"><li style=\\\"-webkit-tap-highlight-color:transparent\\\"><div style=\\\"-webkit-tap-highlight-color:transparent;margin-top:5px;margin-bottom:5px;color:rgb(89,89,89);font-size:14px;line-height:1.8em;letter-spacing:0.02em;\\\"><strong style=\\\"-webkit-tap-highlight-color:transparent;color:rgb(53,148,247);background-attachment:scroll;background-clip:border-box;background-image:none;background-origin:padding-box;background-position:0 0;background-repeat:no-repeat;background-size:auto;width:auto;height:auto;border-style:none;border-width:3px;border-color:rgba(0,0,0,0.4);border-radius:0\\\">重启服务</strong>：</div></li></ol><pre style=\\\"-webkit-tap-highlight-color:transparent;border-radius:5px;box-shadow:rgba(0,0,0,0.55) 0 2px 10px;margin-top:10px;margin-bottom:10px\\\"><span style=\\\"-webkit-tap-highlight-color:transparent;display:block;background:url(https://mmbiz.qpic.cn/mmbiz_svg/eHEMOF2hOelPPWBYXFCk1mBh0l4uqwPblDl2WDokTnYLrRFRuOj9NEeic1AWibCdOkUHurEaziadDsiaYqCFMFhhSdibPsI4GznJv/640?wx_fmt=svg&amp;from=appmsg) 10px 10px/40px no-repeat rgb(40,44,52);height:30px;width:100%;margin-bottom:-7px;border-radius:5px\\\"></span><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;\\\">docker-compose restart<br style=\\\"-webkit-tap-highlight-color:transparent\\\"/></div></pre><p style=\\\"-webkit-tap-highlight-color:transparent;margin:0;color:rgb(43,43,43);font-size:14px;line-height:1.8em;letter-spacing:0.02em;text-indent:0;padding-top:8px;padding-bottom:8px\\\">这个命令将重启所有服务。</p><h3 style=\\\"-webkit-tap-highlight-color:transparent;margin:0;margin-top:30px;margin-bottom:15px;border-style:none;border-width:1px;border-color:rgb(0,0,0);border-radius:0;background-attachment:scroll;background-clip:border-box;background-image:url(https://mmbiz.qpic.cn/sz_mmbiz_png/bA6ibvWzutIZ9bsn4KA0zENgIvE8W3SPINHd3WibA9mmHxdWN7qeElUvu60Spja1VqamYw9wr5ooc6OZ1JbWveAA/640?wx_fmt=png&amp;from=appmsg);background-origin:padding-box;background-position:50% 50%;background-repeat:no-repeat;background-size:30px 30px;width:auto;height:auto;align-items:unset;box-shadow:none;display:flex;flex-direction:unset;float:unset;justify-content:center;line-height:1.5em;overflow:unset;text-shadow:none;transform:none;-webkit-box-reflect:unset\\\"><span style=\\\"-webkit-tap-highlight-color:transparent;font-size:18px;color:rgb(43,43,43);line-height:2.4em;letter-spacing:0;margin-top:38px;margin-bottom:10px;align-items:unset;background-attachment:scroll;background-clip:border-box;background-image:none;background-origin:padding-box;background-position:0 0;background-repeat:no-repeat;background-size:auto;border-style:none;border-width:1px;border-color:rgb(0,0,0);border-radius:0;box-shadow:none;display:inline-block;font-weight:bold;flex-direction:unset;float:unset;height:38px;justify-content:unset;overflow:unset;text-align:center;text-indent:0;text-shadow:none;transform:none;width:auto;-webkit-box-reflect:unset\\\">高级使用</span></h3><p style=\\\"-webkit-tap-highlight-color:transparent;margin:0;color:rgb(43,43,43);font-size:14px;line-height:1.8em;letter-spacing:0.02em;text-indent:0;padding-top:8px;padding-bottom:8px\\\">Docker Compose 还支持许多高级功能，如环境变量、扩展、网络配置等。以下是一些高级用法示例：</p><ol style=\\\"-webkit-tap-highlight-color:transparent;margin:0;margin-top:8px;margin-bottom:8px;padding-left:25px\\\"><li style=\\\"-webkit-tap-highlight-color:transparent\\\"><div style=\\\"-webkit-tap-highlight-color:transparent;margin-top:5px;margin-bottom:5px;color:rgb(89,89,89);font-size:14px;line-height:1.8em;letter-spacing:0.02em;\\\"><strong style=\\\"-webkit-tap-highlight-color:transparent;color:rgb(53,148,247);background-attachment:scroll;background-clip:border-box;background-image:none;background-origin:padding-box;background-position:0 0;background-repeat:no-repeat;background-size:auto;width:auto;height:auto;border-style:none;border-width:3px;border-color:rgba(0,0,0,0.4);border-radius:0\\\">环境变量</strong>：</div></li></ol><pre style=\\\"-webkit-tap-highlight-color:transparent;border-radius:5px;box-shadow:rgba(0,0,0,0.55) 0 2px 10px;margin-top:10px;margin-bottom:10px\\\"><span style=\\\"-webkit-tap-highlight-color:transparent;display:block;background:url(https://mmbiz.qpic.cn/mmbiz_svg/eHEMOF2hOelPPWBYXFCk1mBh0l4uqwPblDl2WDokTnYLrRFRuOj9NEeic1AWibCdOkUHurEaziadDsiaYqCFMFhhSdibPsI4GznJv/640?wx_fmt=svg&amp;from=appmsg) 10px 10px/40px no-repeat rgb(40,44,52);height:30px;width:100%;margin-bottom:-7px;border-radius:5px\\\"></span><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 style=\\\"-webkit-tap-highlight-color:transparent;color:#d19a66;line-height:26px\\\">version:</span> <span style=\\\"-webkit-tap-highlight-color:transparent;color:#98c379;line-height:26px\\\">'3'</span><br style=\\\"-webkit-tap-highlight-color:transparent\\\"/><span style=\\\"-webkit-tap-highlight-color:transparent;color:#d19a66;line-height:26px\\\">services:</span><br style=\\\"-webkit-tap-highlight-color:transparent\\\"/>  <span style=\\\"-webkit-tap-highlight-color:transparent;color:#d19a66;line-height:26px\\\">web:</span><br style=\\\"-webkit-tap-highlight-color:transparent\\\"/>    <span style=\\\"-webkit-tap-highlight-color:transparent;color:#d19a66;line-height:26px\\\">image:</span> <span style=\\\"-webkit-tap-highlight-color:transparent;color:#98c379;line-height:26px\\\">&quot;nginx:alpine&quot;</span><br style=\\\"-webkit-tap-highlight-color:transparent\\\"/>    <span style=\\\"-webkit-tap-highlight-color:transparent;color:#d19a66;line-height:26px\\\">env_file:</span><br style=\\\"-webkit-tap-highlight-color:transparent\\\"/>      <span style=\\\"-webkit-tap-highlight-color:transparent;color:#61aeee;line-height:26px\\\">-</span> <span style=\\\"-webkit-tap-highlight-color:transparent;color:#98c379;line-height:26px\\\">web.env</span><br style=\\\"-webkit-tap-highlight-color:transparent\\\"/></div></pre><p style=\\\"-webkit-tap-highlight-color:transparent;margin:0;color:rgb(43,43,43);font-size:14px;line-height:1.8em;letter-spacing:0.02em;text-indent:0;padding-top:8px;padding-bottom:8px\\\">在这个示例中，<code style=\\\"-webkit-tap-highlight-color:transparent;color:rgb(53,148,247);line-height:1.8em;letter-spacing:0;background:none 0 0/auto no-repeat scroll padding-box border-box rgba(27,31,35,0.05);width:auto;height:auto;margin-left:2px;margin-right:2px;padding:2px 4px;border-style:none;border-width:3px;border-color:rgb(0,0,0) rgba(0,0,0,0.4) rgba(0,0,0,0.4);border-radius:4px;font-family:&quot;Operator Mono&quot;,Consolas,Monaco,Menlo,monospace;word-break:break-all\\\">web</code> 服务将从 <code style=\\\"-webkit-tap-highlight-color:transparent;color:rgb(53,148,247);line-height:1.8em;letter-spacing:0;background:none 0 0/auto no-repeat scroll padding-box border-box rgba(27,31,35,0.05);width:auto;height:auto;margin-left:2px;margin-right:2px;padding:2px 4px;border-style:none;border-width:3px;border-color:rgb(0,0,0) rgba(0,0,0,0.4) rgba(0,0,0,0.4);border-radius:4px;font-family:&quot;Operator Mono&quot;,Consolas,Monaco,Menlo,monospace;word-break:break-all\\\">web.env</code> 文件中读取环境变量。</p><ol start=\\\"2\\\" style=\\\"-webkit-tap-highlight-color:transparent;margin:0;margin-top:8px;margin-bottom:8px;padding-left:25px\\\"><li style=\\\"-webkit-tap-highlight-color:transparent\\\"><div style=\\\"-webkit-tap-highlight-color:transparent;margin-top:5px;margin-bottom:5px;color:rgb(89,89,89);font-size:14px;line-height:1.8em;letter-spacing:0.02em;\\\"><strong style=\\\"-webkit-tap-highlight-color:transparent;color:rgb(53,148,247);background-attachment:scroll;background-clip:border-box;background-image:none;background-origin:padding-box;background-position:0 0;background-repeat:no-repeat;background-size:auto;width:auto;height:auto;border-style:none;border-width:3px;border-color:rgba(0,0,0,0.4);border-radius:0\\\">扩展</strong>：</div></li></ol><pre style=\\\"-webkit-tap-highlight-color:transparent;border-radius:5px;box-shadow:rgba(0,0,0,0.55) 0 2px 10px;margin-top:10px;margin-bottom:10px\\\"><span style=\\\"-webkit-tap-highlight-color:transparent;display:block;background:url(https://mmbiz.qpic.cn/mmbiz_svg/eHEMOF2hOelPPWBYXFCk1mBh0l4uqwPblDl2WDokTnYLrRFRuOj9NEeic1AWibCdOkUHurEaziadDsiaYqCFMFhhSdibPsI4GznJv/640?wx_fmt=svg&amp;from=appmsg) 10px 10px/40px no-repeat rgb(40,44,52);height:30px;width:100%;margin-bottom:-7px;border-radius:5px\\\"></span><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 style=\\\"-webkit-tap-highlight-color:transparent;color:#d19a66;line-height:26px\\\">version:</span> <span style=\\\"-webkit-tap-highlight-color:transparent;color:#98c379;line-height:26px\\\">'3'</span><br style=\\\"-webkit-tap-highlight-color:transparent\\\"/><span style=\\\"-webkit-tap-highlight-color:transparent;color:#d19a66;line-height:26px\\\">services:</span><br style=\\\"-webkit-tap-highlight-color:transparent\\\"/>  <span style=\\\"-webkit-tap-highlight-color:transparent;color:#d19a66;line-height:26px\\\">web:</span><br style=\\\"-webkit-tap-highlight-color:transparent\\\"/>    <span style=\\\"-webkit-tap-highlight-color:transparent;color:#d19a66;line-height:26px\\\">image:</span> <span style=\\\"-webkit-tap-highlight-color:transparent;color:#98c379;line-height:26px\\\">&quot;nginx:alpine&quot;</span><br style=\\\"-webkit-tap-highlight-color:transparent\\\"/>    <span style=\\\"-webkit-tap-highlight-color:transparent;color:#d19a66;line-height:26px\\\">deploy:</span><br style=\\\"-webkit-tap-highlight-color:transparent\\\"/>      <span style=\\\"-webkit-tap-highlight-color:transparent;color:#d19a66;line-height:26px\\\">replicas:</span> <span style=\\\"-webkit-tap-highlight-color:transparent;color:#d19a66;line-height:26px\\\">3</span><br style=\\\"-webkit-tap-highlight-color:transparent\\\"/></div></pre><p style=\\\"-webkit-tap-highlight-color:transparent;margin:0;color:rgb(43,43,43);font-size:14px;line-height:1.8em;letter-spacing:0.02em;text-indent:0;padding-top:8px;padding-bottom:8px\\\">在这个示例中，<code style=\\\"-webkit-tap-highlight-color:transparent;color:rgb(53,148,247);line-height:1.8em;letter-spacing:0;background:none 0 0/auto no-repeat scroll padding-box border-box rgba(27,31,35,0.05);width:auto;height:auto;margin-left:2px;margin-right:2px;padding:2px 4px;border-style:none;border-width:3px;border-color:rgb(0,0,0) rgba(0,0,0,0.4) rgba(0,0,0,0.4);border-radius:4px;font-family:&quot;Operator Mono&quot;,Consolas,Monaco,Menlo,monospace;word-break:break-all\\\">web</code> 服务将被扩展为 3 个副本。这意味着Docker Compose将启动3个相同的web服务实例，它们将作为一个集群运行，以提供高可用性和负载均衡。</p><ol start=\\\"3\\\" style=\\\"-webkit-tap-highlight-color:transparent;margin:0;margin-top:8px;margin-bottom:8px;padding-left:25px\\\"><li style=\\\"-webkit-tap-highlight-color:transparent\\\"><div style=\\\"-webkit-tap-highlight-color:transparent;margin-top:5px;margin-bottom:5px;color:rgb(89,89,89);font-size:14px;line-height:1.8em;letter-spacing:0.02em;\\\"><strong style=\\\"-webkit-tap-highlight-color:transparent;color:rgb(53,148,247);background-attachment:scroll;background-clip:border-box;background-image:none;background-origin:padding-box;background-position:0 0;background-repeat:no-repeat;background-size:auto;width:auto;height:auto;border-style:none;border-width:3px;border-color:rgba(0,0,0,0.4);border-radius:0\\\">网络配置</strong>：</div></li></ol><pre style=\\\"-webkit-tap-highlight-color:transparent;border-radius:5px;box-shadow:rgba(0,0,0,0.55) 0 2px 10px;margin-top:10px;margin-bottom:10px\\\"><span style=\\\"-webkit-tap-highlight-color:transparent;display:block;background:url(https://mmbiz.qpic.cn/mmbiz_svg/eHEMOF2hOelPPWBYXFCk1mBh0l4uqwPblDl2WDokTnYLrRFRuOj9NEeic1AWibCdOkUHurEaziadDsiaYqCFMFhhSdibPsI4GznJv/640?wx_fmt=svg&amp;from=appmsg) 10px 10px/40px no-repeat rgb(40,44,52);height:30px;width:100%;margin-bottom:-7px;border-radius:5px\\\"></span><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 style=\\\"-webkit-tap-highlight-color:transparent;color:#d19a66;line-height:26px\\\">version:</span> <span style=\\\"-webkit-tap-highlight-color:transparent;color:#98c379;line-height:26px\\\">'3'</span><br style=\\\"-webkit-tap-highlight-color:transparent\\\"/><span style=\\\"-webkit-tap-highlight-color:transparent;color:#d19a66;line-height:26px\\\">services:</span><br style=\\\"-webkit-tap-highlight-color:transparent\\\"/>  <span style=\\\"-webkit-tap-highlight-color:transparent;color:#d19a66;line-height:26px\\\">web:</span><br style=\\\"-webkit-tap-highlight-color:transparent\\\"/>    <span style=\\\"-webkit-tap-highlight-color:transparent;color:#d19a66;line-height:26px\\\">image:</span> <span style=\\\"-webkit-tap-highlight-color:transparent;color:#98c379;line-height:26px\\\">&quot;nginx:alpine&quot;</span><br style=\\\"-webkit-tap-highlight-color:transparent\\\"/>    <span style=\\\"-webkit-tap-highlight-color:transparent;color:#d19a66;line-height:26px\\\">networks:</span><br style=\\\"-webkit-tap-highlight-color:transparent\\\"/>      <span style=\\\"-webkit-tap-highlight-color:transparent;color:#61aeee;line-height:26px\\\">-</span> <span style=\\\"-webkit-tap-highlight-color:transparent;color:#98c379;line-height:26px\\\">webnet</span><br style=\\\"-webkit-tap-highlight-color:transparent\\\"/><span style=\\\"-webkit-tap-highlight-color:transparent;color:#d19a66;line-height:26px\\\">networks:</span><br style=\\\"-webkit-tap-highlight-color:transparent\\\"/>  <span style=\\\"-webkit-tap-highlight-color:transparent;color:#d19a66;line-height:26px\\\">webnet:</span><br style=\\\"-webkit-tap-highlight-color:transparent\\\"/></div></pre><p style=\\\"-webkit-tap-highlight-color:transparent;margin:0;color:rgb(43,43,43);font-size:14px;line-height:1.8em;letter-spacing:0.02em;text-indent:0;padding-top:8px;padding-bottom:8px\\\">这段配置文件定义了一个名为web的服务，它将使用nginx:alpine镜像，并连接到一个名为webnet的网络。这个网络也是在同一个配置文件中定义的。这样的配置允许web服务在Docker容器中运行，并且可以通过webnet网络与其他服务进行通信。</p><h2 style=\\\"-webkit-tap-highlight-color:transparent;margin:0;border-color:rgb(0,0,0) rgb(0,0,0) rgb(64,184,250);margin-top:30px;margin-bottom:15px;align-items:unset;background-attachment:scroll;background-clip:border-box;background-image:none;background-origin:padding-box;background-position:0 0;background-repeat:no-repeat;background-size:auto;border-style:none none solid;border-width:1px 1px 4px;border-radius:0;box-shadow:none;flex-direction:unset;float:unset;height:auto;justify-content:unset;line-height:1.5em;overflow:unset;text-shadow:none;transform:none;width:auto;-webkit-box-reflect:unset\\\"><span style=\\\"-webkit-tap-highlight-color:transparent;background-attachment:scroll;background-clip:border-box;background-image:url(https://mmbiz.qpic.cn/sz_mmbiz_png/bA6ibvWzutIZ9bsn4KA0zENgIvE8W3SPI57T6e96Q1fe42BWVgCn2oianXgfh0drrlXK68N1tPUAeHA6o5VtGbSw/640?wx_fmt=png&amp;from=appmsg);background-origin:padding-box;background-position:0 0;background-repeat:no-repeat;background-size:20px 20px;width:20px;height:20px;align-items:unset;border-style:none;border-width:1px;border-color:rgb(0,0,0);border-radius:0;box-shadow:none;display:flex;font-size:22px;font-weight:bold;flex-direction:unset;float:unset;justify-content:unset;letter-spacing:0;line-height:1.5em;margin-bottom:-25px;overflow:unset;text-indent:0;text-shadow:none;transform:none;-webkit-box-reflect:unset\\\"></span><span style=\\\"-webkit-tap-highlight-color:transparent;font-size:20px;color:rgb(64,184,250);line-height:1.5em;letter-spacing:0;align-items:unset;background-attachment:scroll;background-clip:border-box;background-image:none;background-origin:padding-box;background-position:0 0;background-repeat:no-repeat;background-size:auto;border-style:none;border-width:1px;border-color:rgb(0,0,0);border-radius:0;box-shadow:none;display:flex;font-weight:bold;flex-direction:unset;float:unset;height:auto;justify-content:unset;margin-left:25px;overflow:unset;text-indent:0;text-shadow:none;transform:none;width:auto;-webkit-box-reflect:unset\\\">结论</span><span style=\\\"-webkit-tap-highlight-color:transparent;background:none 0 0/auto no-repeat scroll padding-box border-box rgba(64,184,250,0.5);align-items:unset;border-style:none;border-width:1px;border-color:rgb(0,0,0);border-radius:20px 0 0;box-shadow:none;display:flex;font-size:22px;font-weight:bold;flex-direction:unset;float:right;height:10px;justify-content:unset;letter-spacing:0;line-height:1.5em;margin-top:-10px;overflow:unset;text-indent:0;text-shadow:none;transform:none;width:200px;-webkit-box-reflect:unset\\\"></span></h2><p style=\\\"-webkit-tap-highlight-color:transparent;margin:0;color:rgb(43,43,43);font-size:14px;line-height:1.8em;letter-spacing:0.02em;text-indent:0;padding-top:8px;padding-bottom:8px\\\">Docker Compose 是一个强大的工具，用于定义和运行多容器 Docker 应用程序。它简化了应用程序的部署和管理，提高了开发效率。</p></div><p style=\\\"-webkit-tap-highlight-color:transparent;margin:0\\\"><br style=\\\"-webkit-tap-highlight-color:transparent\\\"/></p></div></div></div></div></div></span>\\\n</div></body></html>\\u0000\"]],\"start1\":0,\"start2\":0,\"length1\":0,\"length2\":68090}]"
metadata_diff: {"new":{"id":"bd36c5b5bb54467d9d85098fb5d71b50","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":1764348818412,"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.340Z
created_time: 2025-11-28T21:03:25.340Z
type_: 13