id: 9333d42afa4244f48e755f64c36f21c4
parent_id: 
item_type: 1
item_id: 11064b9ea1694956926e793d49b5499d
item_updated_time: 1764345515192
title_diff: "[{\"diffs\":[[1,\"编写 Dockerfile：从入门到精通\"]],\"start1\":0,\"start2\":0,\"length1\":0,\"length2\":20}]"
body_diff: "[{\"diffs\":[[1,\"<html>\\\r\\\n<head>\\\r\\\n  <title>编写 Dockerfile：从入门到精通</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=\\\"47245\\\"></a>\\\r\\\n<h1>编写 Dockerfile：从入门到精通</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=\\\"https://mp.weixin.qq.com/s?__biz=MzkzNzU1MzIwMw==&amp;mid=2247484118&amp;idx=1&amp;sn=9c3061b0d81aac9a24f16f8e58768a1a&amp;chksm=c316a28000307a5f1a05b9c4cccee4e349eeb65404907572418b1c304db218078c47528120ee&amp;mpshare=1&amp;scene=1&amp;srcid=0818QHATHH269O6kKIGWYHvc&amp;sharer_shareinfo=cd7a17014f95bb08bc90220800c08a54&amp;sharer_shareinfo_first=cd7a17014f95bb08bc90220800c08a54#rd\\\"><span>https://mp.weixin.qq.com/s?__biz=MzkzNzU1MzIwMw==&amp;mid=224748...</span></a></div></div>\\\n<p></p>\\\n<div><span></span></div>\\\n<div style=\\\"\\\"><div><div><h1 style=\\\"margin:0\\\"> 编写 Dockerfile：从入门到精通</h1><div><span style=\\\"position:relative\\\">原创</span><span> 泯泷 </span><span><a style=\\\"position:relative\\\"> 泯泷ML </a></span><span><em></em></span></div><div style=\\\";\\\"><div style=\\\"margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;font-family: 'SF Pro SC', 'HanHei SC', 'SF Pro Text', 'Myriad Set Pro', 'SF Pro Icons', 'Apple Legacy Chevron', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, sans-serif;font-size: 16px;color: rgb(0, 0, 0);line-height: 1.5em;word-spacing: 0em;letter-spacing: 0em;word-break: break-word;overflow-wrap: break-word;text-align: left;padding-top: 10px;padding-right: 10px;padding-bottom: 10px;padding-left: 10px;\\\"><h3 style=\\\"margin:0;margin-top:30px;margin-bottom:5px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:left\\\"><span style=\\\"font-size: 16px;color: rgb(231, 142, 52);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: inline-block;\\\"><span>引言</span></span></h3><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>Dockerfile</span></strong><span> 是容器化技术的核心组成部分，它能让开发者和 DevOps 工程师将应用程序及其所有依赖项打包成轻量级、可移植的容器。本指南将全面讲解 Dockerfile，从基础概念到高级技巧，最终使您掌握编写高效、安全且适合生产环境的 Dockerfile 所需的技能。</span></p><h3 style=\\\"margin:0;margin-top:30px;margin-bottom:5px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:left\\\"><span style=\\\"font-size: 16px;color: rgb(231, 142, 52);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: inline-block;\\\"><span>1. 什么是 Dockerfile？</span></span></h3><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>Dockerfile</span></strong><span> 是一个纯文本文件，包含一系列用于构建 Docker 镜像的指令。Dockerfile 中的每一行都代表镜像构建过程中的一个步骤。创建的镜像是一个轻量级、可移植且自给自足的环境，包含运行应用程序所需的一切，包括库、依赖项和应用程序代码本身。</span></p><h4 style=\\\"margin:0;margin-top:5px;margin-bottom:5px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:left;font-weight:bold;font-size:15px\\\"><span style=\\\"font-size: 15px;color: rgb(231, 142, 52);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: inline-block;\\\"><span>Dockerfile 的关键组件：</span></span></h4><ol style=\\\"margin:0;list-style-type:decimal;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>基础镜像：</span></strong><span> 你的 Docker 镜像构建起点。例如，如果你正在构建一个 Python 应用程序，可能会选择 </span><code style=\\\"line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);color: rgb(231, 142, 52);font-size: 15px;overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;background-color: rgb(255, 246, 237);font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;\\\"><span>python:3.9</span></code><span> 作为基础镜像。</span></div></li><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>应用程序代码与依赖项：</span></strong><span> 将代码添加到镜像中，并安装依赖项以确保应用程序能正确运行。</span></div></li><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>命令与配置项：</span></strong><span> 执行命令、设置环境变量以及暴露端口的相关指令。</span></div></li></ol><h4 style=\\\"margin:0;margin-top:5px;margin-bottom:5px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:left;font-weight:bold;font-size:15px\\\"><span style=\\\"font-size: 15px;color: rgb(231, 142, 52);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: inline-block;\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>为什么 Dockerfile 很重要？</span></strong></span></h4><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>一个 Dockerfile：</span></strong></p><ul style=\\\"margin:0;list-style-type:disc;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>标准化应用程序的构建和部署方式。</span></div></li><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>确保在不同环境（开发、测试、生产）中的一致性。</span></div></li><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>使应用程序具有可移植性且更易于管理。</span></div></li></ul><hr style=\\\"border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: linear-gradient(to right, rgba(248, 57, 41, 0), rgb(244, 138, 0), rgba(248, 57, 41, 0));background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: 2px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px;margin-top: 20px;margin-right: 0px;margin-bottom: 20px;margin-left: 0px;border-top-width: initial;border-right-width: initial;border-bottom-width: initial;border-left-width: initial;border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-top-color: initial;border-right-color: initial;border-bottom-color: initial;border-left-color: initial;border-image-source: initial;border-image-slice: initial;border-image-width: initial;border-image-outset: initial;border-image-repeat: initial;text-align: center;\\\"/><h3 style=\\\"margin:0;margin-top:30px;margin-bottom:5px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:left\\\"><span style=\\\"font-size: 16px;color: rgb(231, 142, 52);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: inline-block;\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>2. 为什么要学习 Dockerfile？</span></strong></span></h3><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><span>Dockerfile 是容器化的基础，也是 DevOps 工程师的关键技能。以下是学习 Dockerfile 的必要性：</span></p><h4 style=\\\"margin:0;margin-top:5px;margin-bottom:5px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:left;font-weight:bold;font-size:15px\\\"><span style=\\\"font-size: 15px;color: rgb(231, 142, 52);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: inline-block;\\\"><span>1. </span><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>跨环境可移植性</span></strong></span></h4><ul style=\\\"margin:0;list-style-type:disc;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>通过 Dockerfile，您可以一次构建镜像，随处运行。这解决了&quot;在我机器上能运行&quot;的难题。</span></div></li></ul><h4 style=\\\"margin:0;margin-top:5px;margin-bottom:5px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:left;font-weight:bold;font-size:15px\\\"><span style=\\\"font-size: 15px;color: rgb(231, 142, 52);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: inline-block;\\\"><span>2. </span><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>简化的 CI/CD 管道</span></strong></span></h4><ul style=\\\"margin:0;list-style-type:disc;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>在 Jenkins、GitHub Actions 或 Azure DevOps 等 CI/CD 管道中使用 Dockerfile，实现应用程序构建、测试和部署的自动化。</span></div></li></ul><h4 style=\\\"margin:0;margin-top:5px;margin-bottom:5px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:left;font-weight:bold;font-size:15px\\\"><span style=\\\"font-size: 15px;color: rgb(231, 142, 52);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: inline-block;\\\"><span>3. </span><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>基础设施版本控制</span></strong></span></h4><ul style=\\\"margin:0;list-style-type:disc;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>如同代码一样，Dockerfile 也可以进行版本控制。基础设施的变更可以被追踪，必要时还能回滚。</span></div></li></ul><h4 style=\\\"margin:0;margin-top:5px;margin-bottom:5px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:left;font-weight:bold;font-size:15px\\\"><span style=\\\"font-size: 15px;color: rgb(231, 142, 52);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: inline-block;\\\"><span>4. </span><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>增强的协作能力</span></strong></span></h4><ul style=\\\"margin:0;list-style-type:disc;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>团队可以共享 Dockerfile 来确保所有人都在相同的环境中工作。这简化了新开发者或贡献者的上手流程。</span></div></li></ul><h4 style=\\\"margin:0;margin-top:5px;margin-bottom:5px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:left;font-weight:bold;font-size:15px\\\"><span style=\\\"font-size: 15px;color: rgb(231, 142, 52);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: inline-block;\\\"><span>5. </span><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>资源效率</span></strong></span></h4><ul style=\\\"margin:0;list-style-type:disc;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>与传统虚拟机相比，通过优化 Dockerfile 创建的 Docker 镜像更加轻量化，资源消耗更低。</span></div></li></ul><h4 style=\\\"margin:0;margin-top:5px;margin-bottom:5px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:left;font-weight:bold;font-size:15px\\\"><span style=\\\"font-size: 15px;color: rgb(231, 142, 52);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: inline-block;\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>示例：</span></strong></span></h4><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><span>假设一个运行在 Node.js 上的 web 应用。使用 Dockerfile 可以将应用与其所需的 Node.js 特定版本打包在一起，无需开发者在本地安装 Node.js，从而确保所有环境的一致性。</span></p><hr style=\\\"border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: linear-gradient(to right, rgba(248, 57, 41, 0), rgb(244, 138, 0), rgba(248, 57, 41, 0));background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: 2px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px;margin-top: 20px;margin-right: 0px;margin-bottom: 20px;margin-left: 0px;border-top-width: initial;border-right-width: initial;border-bottom-width: initial;border-left-width: initial;border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-top-color: initial;border-right-color: initial;border-bottom-color: initial;border-left-color: initial;border-image-source: initial;border-image-slice: initial;border-image-width: initial;border-image-outset: initial;border-image-repeat: initial;text-align: center;\\\"/><h3 style=\\\"margin:0;margin-top:30px;margin-bottom:5px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:left\\\"><span style=\\\"font-size: 16px;color: rgb(231, 142, 52);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: inline-block;\\\"><span>3. </span><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>Dockerfile 基础</span></strong></span></h3><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><span>掌握 Dockerfile 的基础知识对于编写高效实用的文件至关重要。让我们一起来探索这些基础要素。</span></p><h4 style=\\\"margin:0;margin-top:5px;margin-bottom:5px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:left;font-weight:bold;font-size:15px\\\"><span style=\\\"font-size: 15px;color: rgb(231, 142, 52);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: inline-block;\\\"><span>3.1 </span><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>Dockerfile 语法</span></strong></span></h4><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><span>Dockerfile 包含简单的指令，其中每个指令执行特定的操作。其语法通常为：</span></p><pre style=\\\"border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;\\\"><span style=\\\"display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(&quot;https://mmbiz.qpic.cn/mmbiz_svg/OUicWJdJoz3EVP0icdYSluL6ibPu8gGyyppkOaYibPQubxTNicl8Lvra6AT7KZBLm5mufqeo5RKyW6knw9MibdkUU3ACmqjiaEptOkX/640?wx_fmt=svg&amp;from=appmsg&quot;);\\\"></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>INSTRUCTION arguments</span><br/></div></pre><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>例如：</span></strong></p><pre style=\\\"border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;\\\"><span style=\\\"display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(&quot;https://mmbiz.qpic.cn/mmbiz_svg/OUicWJdJoz3EVP0icdYSluL6ibPu8gGyyppkOaYibPQubxTNicl8Lvra6AT7KZBLm5mufqeo5RKyW6knw9MibdkUU3ACmqjiaEptOkX/640?wx_fmt=svg&amp;from=appmsg&quot;);\\\"></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>FROM ubuntu:20.04</span><br/><span>COPY . /app</span><br/><span>RUN apt-get update &amp;&amp; apt-get install -y python3</span><br/><span>CMD [</span><span style=\\\"color: #98c379;line-height: 26px;\\\"><span>&quot;python3&quot;</span></span><span>, </span><span style=\\\"color: #98c379;line-height: 26px;\\\"><span>&quot;/app/app.py&quot;</span></span><span>]</span><br/></div></pre><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>关键要点：</span></strong></p><ul style=\\\"margin:0;list-style-type:disc;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>像 </span><code style=\\\"line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);color: rgb(231, 142, 52);font-size: 15px;overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;background-color: rgb(255, 246, 237);font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;\\\"><span>FROM</span></code><span>、</span><code style=\\\"line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);color: rgb(231, 142, 52);font-size: 15px;overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;background-color: rgb(255, 246, 237);font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;\\\"><span>COPY</span></code><span>、</span><code style=\\\"line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);color: rgb(231, 142, 52);font-size: 15px;overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;background-color: rgb(255, 246, 237);font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;\\\"><span>RUN</span></code><span> 和 </span><code style=\\\"line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);color: rgb(231, 142, 52);font-size: 15px;overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;background-color: rgb(255, 246, 237);font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;\\\"><span>CMD</span></code><span> 这样的指令是区分大小写的，必须用大写字母书写。</span></div></li><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>每条指令都会在 Docker 镜像中创建一个新的</span><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>层</span></strong><span> 。</span></div></li></ul><hr style=\\\"border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: linear-gradient(to right, rgba(248, 57, 41, 0), rgb(244, 138, 0), rgba(248, 57, 41, 0));background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: 2px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px;margin-top: 20px;margin-right: 0px;margin-bottom: 20px;margin-left: 0px;border-top-width: initial;border-right-width: initial;border-bottom-width: initial;border-left-width: initial;border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-top-color: initial;border-right-color: initial;border-bottom-color: initial;border-left-color: initial;border-image-source: initial;border-image-slice: initial;border-image-width: initial;border-image-outset: initial;border-image-repeat: initial;text-align: center;\\\"/><h4 style=\\\"margin:0;margin-top:5px;margin-bottom:5px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:left;font-weight:bold;font-size:15px\\\"><span style=\\\"font-size: 15px;color: rgb(231, 142, 52);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: inline-block;\\\"><span>3.2 </span><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>常用指令</span></strong></span></h4><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><span>让我们分解一些最常用的指令：</span></p><ol style=\\\"margin:0;list-style-type:decimal;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><code style=\\\"height: auto;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);color: rgb(231, 142, 52);font-size: 15px;overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;background-color: rgb(255, 246, 237);font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;\\\"><span>FROM</span></code></strong></p><pre style=\\\"border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;\\\"><span style=\\\"display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(&quot;https://mmbiz.qpic.cn/mmbiz_svg/OUicWJdJoz3EVP0icdYSluL6ibPu8gGyyppkOaYibPQubxTNicl8Lvra6AT7KZBLm5mufqeo5RKyW6knw9MibdkUU3ACmqjiaEptOkX/640?wx_fmt=svg&amp;from=appmsg&quot;);\\\"></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> FROM python:3.9</span><br/></div></pre></div></li><ul style=\\\"margin:0;list-style-type:disc;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>指定构建的基础镜像。</span></div></li><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>示例：</span></div></li></ul></ol><ul style=\\\"margin:0;list-style-type:disc;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>Dockerfile 必须从 </span><code style=\\\"line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);color: rgb(231, 142, 52);font-size: 15px;overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;background-color: rgb(255, 246, 237);font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;\\\"><span>FROM</span></code><span> 指令开始，多阶段构建除外。</span></div></li></ul><ol style=\\\"margin:0;list-style-type:decimal;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><code style=\\\"height: auto;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);color: rgb(231, 142, 52);font-size: 15px;overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;background-color: rgb(255, 246, 237);font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;\\\"><span>COPY</span></code></strong></p><pre style=\\\"border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;\\\"><span style=\\\"display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(&quot;https://mmbiz.qpic.cn/mmbiz_svg/OUicWJdJoz3EVP0icdYSluL6ibPu8gGyyppkOaYibPQubxTNicl8Lvra6AT7KZBLm5mufqeo5RKyW6knw9MibdkUU3ACmqjiaEptOkX/640?wx_fmt=svg&amp;from=appmsg&quot;);\\\"></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> COPY requirements.txt /app/</span><br/></div></pre></div></li><ul style=\\\"margin:0;list-style-type:disc;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>将文件或目录从主机系统复制到容器中。</span></div></li><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>示例：</span></div></li></ul><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><code style=\\\"height: auto;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);color: rgb(231, 142, 52);font-size: 15px;overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;background-color: rgb(255, 246, 237);font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;\\\"><span>RUN</span></code></strong></p><pre style=\\\"border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;\\\"><span style=\\\"display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(&quot;https://mmbiz.qpic.cn/mmbiz_svg/OUicWJdJoz3EVP0icdYSluL6ibPu8gGyyppkOaYibPQubxTNicl8Lvra6AT7KZBLm5mufqeo5RKyW6knw9MibdkUU3ACmqjiaEptOkX/640?wx_fmt=svg&amp;from=appmsg&quot;);\\\"></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> RUN apt-get update &amp;&amp; apt-get install -y curl</span><br/></div></pre></div></li><ul style=\\\"margin:0;list-style-type:disc;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>在构建过程中执行命令。常用于安装软件包。</span></div></li><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>示例：</span></div></li></ul><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><code style=\\\"height: auto;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);color: rgb(231, 142, 52);font-size: 15px;overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;background-color: rgb(255, 246, 237);font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;\\\"><span>CMD</span></code></strong></p><pre style=\\\"border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;\\\"><span style=\\\"display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(&quot;https://mmbiz.qpic.cn/mmbiz_svg/OUicWJdJoz3EVP0icdYSluL6ibPu8gGyyppkOaYibPQubxTNicl8Lvra6AT7KZBLm5mufqeo5RKyW6knw9MibdkUU3ACmqjiaEptOkX/640?wx_fmt=svg&amp;from=appmsg&quot;);\\\"></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> CMD [</span><span style=\\\"color: #98c379;line-height: 26px;\\\"><span>&quot;python3&quot;</span></span><span>, </span><span style=\\\"color: #98c379;line-height: 26px;\\\"><span>&quot;app.py&quot;</span></span><span>]</span><br/></div></pre></div></li><ul style=\\\"margin:0;list-style-type:disc;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>指定容器启动时运行的默认命令。</span></div></li><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>示例：</span></div></li></ul><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><code style=\\\"height: auto;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);color: rgb(231, 142, 52);font-size: 15px;overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;background-color: rgb(255, 246, 237);font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;\\\"><span>WORKDIR</span></code></strong></p><pre style=\\\"border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;\\\"><span style=\\\"display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(&quot;https://mmbiz.qpic.cn/mmbiz_svg/OUicWJdJoz3EVP0icdYSluL6ibPu8gGyyppkOaYibPQubxTNicl8Lvra6AT7KZBLm5mufqeo5RKyW6knw9MibdkUU3ACmqjiaEptOkX/640?wx_fmt=svg&amp;from=appmsg&quot;);\\\"></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> WORKDIR /usr/src/app</span><br/></div></pre></div></li><ul style=\\\"margin:0;list-style-type:disc;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>设置容器内部的工作目录。</span></div></li><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>示例：</span></div></li></ul><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><code style=\\\"height: auto;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);color: rgb(231, 142, 52);font-size: 15px;overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;background-color: rgb(255, 246, 237);font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;\\\"><span>EXPOSE</span></code></strong></p><pre style=\\\"border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;\\\"><span style=\\\"display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(&quot;https://mmbiz.qpic.cn/mmbiz_svg/OUicWJdJoz3EVP0icdYSluL6ibPu8gGyyppkOaYibPQubxTNicl8Lvra6AT7KZBLm5mufqeo5RKyW6knw9MibdkUU3ACmqjiaEptOkX/640?wx_fmt=svg&amp;from=appmsg&quot;);\\\"></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> EXPOSE 8080</span><br/></div></pre></div></li><ul style=\\\"margin:0;list-style-type:disc;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>记录容器监听的端口。</span></div></li><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>示例：</span></div></li></ul></ol><hr style=\\\"border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: linear-gradient(to right, rgba(248, 57, 41, 0), rgb(244, 138, 0), rgba(248, 57, 41, 0));background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: 2px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px;margin-top: 20px;margin-right: 0px;margin-bottom: 20px;margin-left: 0px;border-top-width: initial;border-right-width: initial;border-bottom-width: initial;border-left-width: initial;border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-top-color: initial;border-right-color: initial;border-bottom-color: initial;border-left-color: initial;border-image-source: initial;border-image-slice: initial;border-image-width: initial;border-image-outset: initial;border-image-repeat: initial;text-align: center;\\\"/><h3 style=\\\"margin:0;margin-top:30px;margin-bottom:5px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:left\\\"><span style=\\\"font-size: 16px;color: rgb(231, 142, 52);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: inline-block;\\\"><span>4. </span><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>中级 Dockerfile 概念</span></strong></span></h3><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><span>掌握基础知识后，就可以开始使用 Dockerfile 的高级功能来优化和增强构建过程。</span></p><hr style=\\\"border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: linear-gradient(to right, rgba(248, 57, 41, 0), rgb(244, 138, 0), rgba(248, 57, 41, 0));background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: 2px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px;margin-top: 20px;margin-right: 0px;margin-bottom: 20px;margin-left: 0px;border-top-width: initial;border-right-width: initial;border-bottom-width: initial;border-left-width: initial;border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-top-color: initial;border-right-color: initial;border-bottom-color: initial;border-left-color: initial;border-image-source: initial;border-image-slice: initial;border-image-width: initial;border-image-outset: initial;border-image-repeat: initial;text-align: center;\\\"/><h4 style=\\\"margin:0;margin-top:5px;margin-bottom:5px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:left;font-weight:bold;font-size:15px\\\"><span style=\\\"font-size: 15px;color: rgb(231, 142, 52);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: inline-block;\\\"><span>4.1 </span><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>构建多阶段 Dockerfile</span></strong></span></h4><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><span>多阶段构建允许您通过分离构建和运行时环境来创建精简的生产镜像。</span></p><ul style=\\\"margin:0;list-style-type:disc;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>阶段 1（构建器）：</span></strong><span> 安装依赖项、编译代码并构建应用程序。</span></div></li><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>阶段 2（生产环境）：</span></strong><span> 仅从构建阶段复制必要的文件。</span></div></li></ul><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><span>示例：</span></p><pre style=\\\"border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;\\\"><span style=\\\"display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(&quot;https://mmbiz.qpic.cn/mmbiz_svg/OUicWJdJoz3EVP0icdYSluL6ibPu8gGyyppkOaYibPQubxTNicl8Lvra6AT7KZBLm5mufqeo5RKyW6knw9MibdkUU3ACmqjiaEptOkX/640?wx_fmt=svg&amp;from=appmsg&quot;);\\\"></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=\\\"color: #5c6370;font-style: italic;line-height: 26px;\\\"><span># Stage 1: Build the application</span></span><br/><span>FROM node:16 AS builder</span><br/><span>WORKDIR /app</span><br/><span>COPY package.json .</span><br/><span>RUN npm install</span><br/><span>COPY . .</span><br/><span>RUN npm run build</span><br/><br/><span style=\\\"color: #5c6370;font-style: italic;line-height: 26px;\\\"><span># Stage 2: Run the application</span></span><br/><span>FROM nginx:alpine</span><br/><span>COPY --from=builder /app/build /usr/share/nginx/html</span><br/><span>EXPOSE 80</span><br/><span>CMD [</span><span style=\\\"color: #98c379;line-height: 26px;\\\"><span>&quot;nginx&quot;</span></span><span>, </span><span style=\\\"color: #98c379;line-height: 26px;\\\"><span>&quot;-g&quot;</span></span><span>, </span><span style=\\\"color: #98c379;line-height: 26px;\\\"><span>&quot;daemon off;&quot;</span></span><span>]</span><br/></div></pre><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>优势：</span></strong></p><ul style=\\\"margin:0;list-style-type:disc;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>更小的生产环境镜像。</span></div></li><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>将构建工具排除在运行时环境之外，提升安全性。</span></div></li></ul><hr style=\\\"border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: linear-gradient(to right, rgba(248, 57, 41, 0), rgb(244, 138, 0), rgba(248, 57, 41, 0));background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: 2px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px;margin-top: 20px;margin-right: 0px;margin-bottom: 20px;margin-left: 0px;border-top-width: initial;border-right-width: initial;border-bottom-width: initial;border-left-width: initial;border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-top-color: initial;border-right-color: initial;border-bottom-color: initial;border-left-color: initial;border-image-source: initial;border-image-slice: initial;border-image-width: initial;border-image-outset: initial;border-image-repeat: initial;text-align: center;\\\"/><h4 style=\\\"margin:0;margin-top:5px;margin-bottom:5px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:left;font-weight:bold;font-size:15px\\\"><span style=\\\"font-size: 15px;color: rgb(231, 142, 52);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: inline-block;\\\"><span>4.2 </span><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>使用环境变量</span></strong></span></h4><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><span>环境变量使 Dockerfile 更具灵活性和可复用性。</span></p><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>示例：</span></strong></p><pre style=\\\"border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;\\\"><span style=\\\"display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(&quot;https://mmbiz.qpic.cn/mmbiz_svg/OUicWJdJoz3EVP0icdYSluL6ibPu8gGyyppkOaYibPQubxTNicl8Lvra6AT7KZBLm5mufqeo5RKyW6knw9MibdkUU3ACmqjiaEptOkX/640?wx_fmt=svg&amp;from=appmsg&quot;);\\\"></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>ENV APP_ENV=production</span><br/><span>CMD [</span><span style=\\\"color: #98c379;line-height: 26px;\\\"><span>&quot;node&quot;</span></span><span>, </span><span style=\\\"color: #98c379;line-height: 26px;\\\"><span>&quot;server.js&quot;</span></span><span>, </span><span style=\\\"color: #98c379;line-height: 26px;\\\"><span>&quot;--env&quot;</span></span><span>, </span><span style=\\\"color: #98c379;line-height: 26px;\\\"><span>&quot;</span><span style=\\\"color: #d19a66;line-height: 26px;\\\"><span>$APP_ENV</span></span><span>&quot;</span></span><span>]</span><br/></div></pre><ul style=\\\"margin:0;list-style-type:disc;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>使用 </span><code style=\\\"line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);color: rgb(231, 142, 52);font-size: 15px;overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;background-color: rgb(255, 246, 237);font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;\\\"><span>ENV</span></code><span> 来定义变量。</span></div></li><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>使用 </span><code style=\\\"line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);color: rgb(231, 142, 52);font-size: 15px;overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;background-color: rgb(255, 246, 237);font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;\\\"><span>docker run -e</span></code><span> 在运行时覆盖变量：</span></div></li></ul><pre style=\\\"border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;\\\"><span style=\\\"display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(&quot;https://mmbiz.qpic.cn/mmbiz_svg/OUicWJdJoz3EVP0icdYSluL6ibPu8gGyyppkOaYibPQubxTNicl8Lvra6AT7KZBLm5mufqeo5RKyW6knw9MibdkUU3ACmqjiaEptOkX/640?wx_fmt=svg&amp;from=appmsg&quot;);\\\"></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>  docker run -e APP_ENV=development myapp</span><br/></div></pre><hr style=\\\"border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: linear-gradient(to right, rgba(248, 57, 41, 0), rgb(244, 138, 0), rgba(248, 57, 41, 0));background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: 2px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px;margin-top: 20px;margin-right: 0px;margin-bottom: 20px;margin-left: 0px;border-top-width: initial;border-right-width: initial;border-bottom-width: initial;border-left-width: initial;border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-top-color: initial;border-right-color: initial;border-bottom-color: initial;border-left-color: initial;border-image-source: initial;border-image-slice: initial;border-image-width: initial;border-image-outset: initial;border-image-repeat: initial;text-align: center;\\\"/><h4 style=\\\"margin:0;margin-top:5px;margin-bottom:5px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:left;font-weight:bold;font-size:15px\\\"><span style=\\\"font-size: 15px;color: rgb(231, 142, 52);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: inline-block;\\\"><span>4.3 </span><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>添加健康检查</span></strong></span></h4><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><code style=\\\"line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);color: rgb(231, 142, 52);font-size: 15px;overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;background-color: rgb(255, 246, 237);font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;\\\"><span>HEALTHCHECK</span></code><span> 指令定义了检查容器健康状态的命令。</span></p><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>示例：</span></strong></p><pre style=\\\"border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;\\\"><span style=\\\"display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(&quot;https://mmbiz.qpic.cn/mmbiz_svg/OUicWJdJoz3EVP0icdYSluL6ibPu8gGyyppkOaYibPQubxTNicl8Lvra6AT7KZBLm5mufqeo5RKyW6knw9MibdkUU3ACmqjiaEptOkX/640?wx_fmt=svg&amp;from=appmsg&quot;);\\\"></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>HEALTHCHECK --interval=30s --timeout=10s --retries=3 CMD curl -f http://localhost:8080/health || </span><span style=\\\"color: #e6c07b;line-height: 26px;\\\"><span>exit</span></span><span> 1</span><br/></div></pre><ul style=\\\"margin:0;list-style-type:disc;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>作用：</span></strong><span> 确保容器内的应用程序按预期运行。</span></div></li><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>自动重启：</span></strong><span> 如果健康检查失败，Docker 可以重启容器。</span></div></li></ul><hr style=\\\"border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: linear-gradient(to right, rgba(248, 57, 41, 0), rgb(244, 138, 0), rgba(248, 57, 41, 0));background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: 2px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px;margin-top: 20px;margin-right: 0px;margin-bottom: 20px;margin-left: 0px;border-top-width: initial;border-right-width: initial;border-bottom-width: initial;border-left-width: initial;border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-top-color: initial;border-right-color: initial;border-bottom-color: initial;border-left-color: initial;border-image-source: initial;border-image-slice: initial;border-image-width: initial;border-image-outset: initial;border-image-repeat: initial;text-align: center;\\\"/><h3 style=\\\"margin:0;margin-top:30px;margin-bottom:5px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:left\\\"><span style=\\\"font-size: 16px;color: rgb(231, 142, 52);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: inline-block;\\\"><span>5. </span><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>Dockerfile 高级技巧</span></strong></span></h3><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><span>高级技巧可以帮助你创建经过优化、安全且可用于生产环境的镜像。</span></p><hr style=\\\"border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: linear-gradient(to right, rgba(248, 57, 41, 0), rgb(244, 138, 0), rgba(248, 57, 41, 0));background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: 2px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px;margin-top: 20px;margin-right: 0px;margin-bottom: 20px;margin-left: 0px;border-top-width: initial;border-right-width: initial;border-bottom-width: initial;border-left-width: initial;border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-top-color: initial;border-right-color: initial;border-bottom-color: initial;border-left-color: initial;border-image-source: initial;border-image-slice: initial;border-image-width: initial;border-image-outset: initial;border-image-repeat: initial;text-align: center;\\\"/><h4 style=\\\"margin:0;margin-top:5px;margin-bottom:5px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:left;font-weight:bold;font-size:15px\\\"><span style=\\\"font-size: 15px;color: rgb(231, 142, 52);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: inline-block;\\\"><span>5.1 </span><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>优化镜像大小</span></strong></span></h4><ol style=\\\"margin:0;list-style-type:decimal;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>使用更小体积的基础镜像</span></strong></p><pre style=\\\"border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;\\\"><span style=\\\"display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(&quot;https://mmbiz.qpic.cn/mmbiz_svg/OUicWJdJoz3EVP0icdYSluL6ibPu8gGyyppkOaYibPQubxTNicl8Lvra6AT7KZBLm5mufqeo5RKyW6knw9MibdkUU3ACmqjiaEptOkX/640?wx_fmt=svg&amp;from=appmsg&quot;);\\\"></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> FROM python:3.9-alpine</span><br/></div></pre></div></li><ul style=\\\"margin:0;list-style-type:disc;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>用最小化镜像替代默认镜像，例如 </span><code style=\\\"line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);color: rgb(231, 142, 52);font-size: 15px;overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;background-color: rgb(255, 246, 237);font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;\\\"><span>alpine</span></code></div></li></ul><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>最小化层数</span></strong></p><pre style=\\\"border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;\\\"><span style=\\\"display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(&quot;https://mmbiz.qpic.cn/mmbiz_svg/OUicWJdJoz3EVP0icdYSluL6ibPu8gGyyppkOaYibPQubxTNicl8Lvra6AT7KZBLm5mufqeo5RKyW6knw9MibdkUU3ACmqjiaEptOkX/640?wx_fmt=svg&amp;from=appmsg&quot;);\\\"></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> RUN apt-get update &amp;&amp; apt-get install -y curl &amp;&amp; apt-get clean</span><br/></div></pre></div></li><ul style=\\\"margin:0;list-style-type:disc;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>合并命令以减少层数：</span></div></li></ul></ol><hr style=\\\"border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: linear-gradient(to right, rgba(248, 57, 41, 0), rgb(244, 138, 0), rgba(248, 57, 41, 0));background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: 2px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px;margin-top: 20px;margin-right: 0px;margin-bottom: 20px;margin-left: 0px;border-top-width: initial;border-right-width: initial;border-bottom-width: initial;border-left-width: initial;border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-top-color: initial;border-right-color: initial;border-bottom-color: initial;border-left-color: initial;border-image-source: initial;border-image-slice: initial;border-image-width: initial;border-image-outset: initial;border-image-repeat: initial;text-align: center;\\\"/><h4 style=\\\"margin:0;margin-top:5px;margin-bottom:5px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:left;font-weight:bold;font-size:15px\\\"><span style=\\\"font-size: 15px;color: rgb(231, 142, 52);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: inline-block;\\\"><span>5.2 </span><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>使用构建参数</span></strong></span></h4><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><span>构建参数（</span><code style=\\\"line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);color: rgb(231, 142, 52);font-size: 15px;overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;background-color: rgb(255, 246, 237);font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;\\\"><span>ARG</span></code><span>）允许在构建期间动态配置镜像。</span></p><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>示例：</span></strong></p><pre style=\\\"border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;\\\"><span style=\\\"display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(&quot;https://mmbiz.qpic.cn/mmbiz_svg/OUicWJdJoz3EVP0icdYSluL6ibPu8gGyyppkOaYibPQubxTNicl8Lvra6AT7KZBLm5mufqeo5RKyW6knw9MibdkUU3ACmqjiaEptOkX/640?wx_fmt=svg&amp;from=appmsg&quot;);\\\"></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>ARG APP_VERSION=1.0</span><br/><span>RUN </span><span style=\\\"color: #e6c07b;line-height: 26px;\\\"><span>echo</span></span><span> </span><span style=\\\"color: #98c379;line-height: 26px;\\\"><span>&quot;Building version </span><span style=\\\"color: #d19a66;line-height: 26px;\\\"><span>$APP_VERSION</span></span><span>&quot;</span></span><br/></div></pre><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><span>在构建时传递值：</span></p><pre style=\\\"border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;\\\"><span style=\\\"display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(&quot;https://mmbiz.qpic.cn/mmbiz_svg/OUicWJdJoz3EVP0icdYSluL6ibPu8gGyyppkOaYibPQubxTNicl8Lvra6AT7KZBLm5mufqeo5RKyW6knw9MibdkUU3ACmqjiaEptOkX/640?wx_fmt=svg&amp;from=appmsg&quot;);\\\"></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>docker build --build-arg APP_VERSION=2.0 .</span><br/></div></pre><hr style=\\\"border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: linear-gradient(to right, rgba(248, 57, 41, 0), rgb(244, 138, 0), rgba(248, 57, 41, 0));background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: 2px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px;margin-top: 20px;margin-right: 0px;margin-bottom: 20px;margin-left: 0px;border-top-width: initial;border-right-width: initial;border-bottom-width: initial;border-left-width: initial;border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-top-color: initial;border-right-color: initial;border-bottom-color: initial;border-left-color: initial;border-image-source: initial;border-image-slice: initial;border-image-width: initial;border-image-outset: initial;border-image-repeat: initial;text-align: center;\\\"/><h4 style=\\\"margin:0;margin-top:5px;margin-bottom:5px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:left;font-weight:bold;font-size:15px\\\"><span style=\\\"font-size: 15px;color: rgb(231, 142, 52);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: inline-block;\\\"><span>5.3 </span><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>实施安全最佳实践</span></strong></span></h4><ol style=\\\"margin:0;list-style-type:decimal;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>避免使用 root 用户：</span></strong><span> 创建并使用非 root 用户以增强安全性。</span></div></li></ol><pre style=\\\"border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;\\\"><span style=\\\"display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(&quot;https://mmbiz.qpic.cn/mmbiz_svg/OUicWJdJoz3EVP0icdYSluL6ibPu8gGyyppkOaYibPQubxTNicl8Lvra6AT7KZBLm5mufqeo5RKyW6knw9MibdkUU3ACmqjiaEptOkX/640?wx_fmt=svg&amp;from=appmsg&quot;);\\\"></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>   RUN adduser --disabled-password appuser</span><br/><span>   USER appuser</span><br/></div></pre><ol style=\\\"margin:0;list-style-type:decimal;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>使用可信的基础镜像：</span></strong><span> 坚持使用官方或经过验证的镜像，以降低漏洞风险。</span></div></li></ol><pre style=\\\"border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;\\\"><span style=\\\"display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(&quot;https://mmbiz.qpic.cn/mmbiz_svg/OUicWJdJoz3EVP0icdYSluL6ibPu8gGyyppkOaYibPQubxTNicl8Lvra6AT7KZBLm5mufqeo5RKyW6knw9MibdkUU3ACmqjiaEptOkX/640?wx_fmt=svg&amp;from=appmsg&quot;);\\\"></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>   FROM nginx:stable</span><br/></div></pre><ol style=\\\"margin:0;list-style-type:decimal;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>扫描镜像漏洞：</span></strong><span> 使用 </span><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>Trivy</span></strong><span> 或 </span><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>Snyk</span></strong><span> 等工具扫描镜像：</span></div></li></ol><pre style=\\\"border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;\\\"><span style=\\\"display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(&quot;https://mmbiz.qpic.cn/mmbiz_svg/OUicWJdJoz3EVP0icdYSluL6ibPu8gGyyppkOaYibPQubxTNicl8Lvra6AT7KZBLm5mufqeo5RKyW6knw9MibdkUU3ACmqjiaEptOkX/640?wx_fmt=svg&amp;from=appmsg&quot;);\\\"></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>   trivy image myimage</span><br/></div></pre><hr style=\\\"border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: linear-gradient(to right, rgba(248, 57, 41, 0), rgb(244, 138, 0), rgba(248, 57, 41, 0));background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: 2px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px;margin-top: 20px;margin-right: 0px;margin-bottom: 20px;margin-left: 0px;border-top-width: initial;border-right-width: initial;border-bottom-width: initial;border-left-width: initial;border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-top-color: initial;border-right-color: initial;border-bottom-color: initial;border-left-color: initial;border-image-source: initial;border-image-slice: initial;border-image-width: initial;border-image-outset: initial;border-image-repeat: initial;text-align: center;\\\"/><h2 style=\\\"margin:0;margin-top:30px;margin-bottom:15px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:center;background-position-x:center;background-position-y:center;background-repeat:no-repeat;background-attachment:initial;background-origin:initial;background-clip:initial;background-size:46px\\\"><span style=\\\"display: inline-block;background-size: 100% 100%;background-repeat: no-repeat;width: 28px;height: 28px;margin-bottom: -6px;margin-right: 0px;background-image: url(&quot;https://mmbiz.qpic.cn/sz_mmbiz_gif/vP5B4VX5s6tUlafuLvML6Y8yN2EbOlicPkRa4KCUAUFS6aA2LQ4C0fFQ1zePdsGC2S9eX6GMKYTyX8gPCHaj0vg/640?wx_fmt=gif&amp;from=appmsg&quot;);\\\"></span><span style=\\\"font-size: 18px;color: rgb(231, 142, 52);line-height: 60px;letter-spacing: 0em;text-align: center;font-weight: bold;display: inline-block;height: 46px;background-position-x: left;background-position-y: center;background-repeat: no-repeat;background-attachment: initial;background-origin: initial;background-clip: initial;\\\"><span>6. </span><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>Dockerfile 调试与故障排除</span></strong></span></h2><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><span>在使用 Dockerfile 时，镜像构建或运行时遇到错误是很常见的情况。掌握有效的调试和故障排除技巧可以节省时间并快速定位问题。</span></p><h3 style=\\\"margin:0;margin-top:30px;margin-bottom:5px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:left\\\"><span style=\\\"font-size: 16px;color: rgb(231, 142, 52);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: inline-block;\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>调试 Dockerfile 的步骤</span></strong></span></h3><ol style=\\\"margin:0;list-style-type:decimal;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>增量构建镜像</span></strong></p><pre style=\\\"border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;\\\"><span style=\\\"display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(&quot;https://mmbiz.qpic.cn/mmbiz_svg/OUicWJdJoz3EVP0icdYSluL6ibPu8gGyyppkOaYibPQubxTNicl8Lvra6AT7KZBLm5mufqeo5RKyW6knw9MibdkUU3ACmqjiaEptOkX/640?wx_fmt=svg&amp;from=appmsg&quot;);\\\"></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> docker build --target builder -t debug-image .</span><br/></div></pre></div></li><ul style=\\\"margin:0;list-style-type:disc;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>使用 </span><code style=\\\"line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);color: rgb(231, 142, 52);font-size: 15px;overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;background-color: rgb(255, 246, 237);font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;\\\"><span>--target</span></code><span> 标志来构建多阶段 Dockerfile 中的特定阶段。这可以帮助你隔离构建过程中不同阶段出现的问题。</span></div></li></ul><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>检查中间层</span></strong></p><pre style=\\\"border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;\\\"><span style=\\\"display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(&quot;https://mmbiz.qpic.cn/mmbiz_svg/OUicWJdJoz3EVP0icdYSluL6ibPu8gGyyppkOaYibPQubxTNicl8Lvra6AT7KZBLm5mufqeo5RKyW6knw9MibdkUU3ACmqjiaEptOkX/640?wx_fmt=svg&amp;from=appmsg&quot;);\\\"></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> docker </span><span style=\\\"color: #e6c07b;line-height: 26px;\\\"><span>history</span></span><span> &lt;image_id&gt;</span><br/></div></pre></div></li><ul style=\\\"margin:0;list-style-type:disc;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>使用 </span><code style=\\\"line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);color: rgb(231, 142, 52);font-size: 15px;overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;background-color: rgb(255, 246, 237);font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;\\\"><span>docker history</span></code><span> 查看镜像层并识别不必要的命令或问题：</span></div></li></ul><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>使用 </span><code style=\\\"height: auto;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);color: rgb(231, 142, 52);font-size: 15px;overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;background-color: rgb(255, 246, 237);font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;\\\"><span>RUN</span></code><span> 进行调试</span></strong></p><pre style=\\\"border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;\\\"><span style=\\\"display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(&quot;https://mmbiz.qpic.cn/mmbiz_svg/OUicWJdJoz3EVP0icdYSluL6ibPu8gGyyppkOaYibPQubxTNicl8Lvra6AT7KZBLm5mufqeo5RKyW6knw9MibdkUU3ACmqjiaEptOkX/640?wx_fmt=svg&amp;from=appmsg&quot;);\\\"></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> RUN </span><span style=\\\"color: #e6c07b;line-height: 26px;\\\"><span>echo</span></span><span> </span><span style=\\\"color: #98c379;line-height: 26px;\\\"><span>&quot;File exists:&quot;</span></span><span> &amp;&amp; ls /path/to/file</span><br/></div></pre></div></li><ul style=\\\"margin:0;list-style-type:disc;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>在 </span><code style=\\\"line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);color: rgb(231, 142, 52);font-size: 15px;overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;background-color: rgb(255, 246, 237);font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;\\\"><span>RUN</span></code><span> 指令中添加调试命令。例如，添加 </span><code style=\\\"line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);color: rgb(231, 142, 52);font-size: 15px;overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;background-color: rgb(255, 246, 237);font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;\\\"><span>echo</span></code><span> 语句可以帮助验证文件路径或配置：</span></div></li></ul><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>日志文件</span></strong></p><pre style=\\\"border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;\\\"><span style=\\\"display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(&quot;https://mmbiz.qpic.cn/mmbiz_svg/OUicWJdJoz3EVP0icdYSluL6ibPu8gGyyppkOaYibPQubxTNicl8Lvra6AT7KZBLm5mufqeo5RKyW6knw9MibdkUU3ACmqjiaEptOkX/640?wx_fmt=svg&amp;from=appmsg&quot;);\\\"></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> docker logs &lt;container_id&gt;</span><br/></div></pre></div></li><ul style=\\\"margin:0;list-style-type:disc;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>容器内运行的服务产生的日志文件或输出可以帮助发现运行时错误。使用 </span><code style=\\\"line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);color: rgb(231, 142, 52);font-size: 15px;overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;background-color: rgb(255, 246, 237);font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;\\\"><span>docker logs</span></code><span> 命令：</span></div></li></ul><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>检查构建上下文</span></strong></p></div></li><ul style=\\\"margin:0;list-style-type:disc;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>确保不会将不必要的文件发送到构建上下文，这可能导致构建时间增加并引发意外问题。使用 </span><code style=\\\"line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);color: rgb(231, 142, 52);font-size: 15px;overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;background-color: rgb(255, 246, 237);font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;\\\"><span>.dockerignore</span></code><span> 文件来过滤文件。</span></div></li></ul></ol><h3 style=\\\"margin:0;margin-top:30px;margin-bottom:5px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:left\\\"><span style=\\\"font-size: 16px;color: rgb(231, 142, 52);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: inline-block;\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>常见错误及修复方法</span></strong></span></h3><ol style=\\\"margin:0;list-style-type:decimal;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>错误：文件未找到</span></strong></div></li><ul style=\\\"margin:0;list-style-type:disc;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>原因：</span></strong><span> 使用 </span><code style=\\\"line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);color: rgb(231, 142, 52);font-size: 15px;overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;background-color: rgb(255, 246, 237);font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;\\\"><span>COPY</span></code><span> 或 </span><code style=\\\"line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);color: rgb(231, 142, 52);font-size: 15px;overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;background-color: rgb(255, 246, 237);font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;\\\"><span>ADD</span></code><span> 命令复制的文件在指定路径中不存在。</span></div></li><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>解决方法：</span></strong><span> 检查文件路径并使用 </span><code style=\\\"line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);color: rgb(231, 142, 52);font-size: 15px;overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;background-color: rgb(255, 246, 237);font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;\\\"><span>WORKDIR</span></code><span> 设置正确的目录。</span></div></li></ul><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>错误：依赖项未安装</span></strong></div></li><ul style=\\\"margin:0;list-style-type:disc;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>原因：</span></strong><span> 缺少依赖项或安装命令不正确。</span></div></li><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>解决方法：</span></strong><span> 安装软件前使用 </span><code style=\\\"line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);color: rgb(231, 142, 52);font-size: 15px;overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;background-color: rgb(255, 246, 237);font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;\\\"><span>RUN</span></code><span> 更新包列表(</span><code style=\\\"line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);color: rgb(231, 142, 52);font-size: 15px;overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;background-color: rgb(255, 246, 237);font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;\\\"><span>apt-get update</span></code><span>)。</span></div></li></ul><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>权限错误</span></strong></div></li><ul style=\\\"margin:0;list-style-type:disc;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>原因：</span></strong><span> 以错误的用户身份运行进程或访问文件。</span></div></li><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>解决方案：</span></strong><span> 使用 </span><code style=\\\"line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);color: rgb(231, 142, 52);font-size: 15px;overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;background-color: rgb(255, 246, 237);font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;\\\"><span>USER</span></code><span> 指令切换到非 root 用户。</span></div></li></ul></ol><hr style=\\\"border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: linear-gradient(to right, rgba(248, 57, 41, 0), rgb(244, 138, 0), rgba(248, 57, 41, 0));background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: 2px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px;margin-top: 20px;margin-right: 0px;margin-bottom: 20px;margin-left: 0px;border-top-width: initial;border-right-width: initial;border-bottom-width: initial;border-left-width: initial;border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-top-color: initial;border-right-color: initial;border-bottom-color: initial;border-left-color: initial;border-image-source: initial;border-image-slice: initial;border-image-width: initial;border-image-outset: initial;border-image-repeat: initial;text-align: center;\\\"/><h2 style=\\\"margin:0;margin-top:30px;margin-bottom:15px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:center;background-position-x:center;background-position-y:center;background-repeat:no-repeat;background-attachment:initial;background-origin:initial;background-clip:initial;background-size:46px\\\"><span style=\\\"display: inline-block;background-size: 100% 100%;background-repeat: no-repeat;width: 28px;height: 28px;margin-bottom: -6px;margin-right: 0px;background-image: url(&quot;https://mmbiz.qpic.cn/sz_mmbiz_gif/vP5B4VX5s6tUlafuLvML6Y8yN2EbOlicPkRa4KCUAUFS6aA2LQ4C0fFQ1zePdsGC2S9eX6GMKYTyX8gPCHaj0vg/640?wx_fmt=gif&amp;from=appmsg&quot;);\\\"></span><span style=\\\"font-size: 18px;color: rgb(231, 142, 52);line-height: 60px;letter-spacing: 0em;text-align: center;font-weight: bold;display: inline-block;height: 46px;background-position-x: left;background-position-y: center;background-repeat: no-repeat;background-attachment: initial;background-origin: initial;background-clip: initial;\\\"><span>7. </span><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>编写 Dockerfile 的最佳实践</span></strong></span></h2><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><span>要创建简洁、高效且安全的 Dockerfile，请遵循这些行业公认的最佳实践：</span></p><h3 style=\\\"margin:0;margin-top:30px;margin-bottom:5px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:left\\\"><span style=\\\"font-size: 16px;color: rgb(231, 142, 52);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: inline-block;\\\"><span>1. </span><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>固定镜像版本</span></strong></span></h3><ul style=\\\"margin:0;list-style-type:disc;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><span>避免使用 </span><code style=\\\"height: auto;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);color: rgb(231, 142, 52);font-size: 15px;overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;background-color: rgb(255, 246, 237);font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;\\\"><span>latest</span></code><span> 标签作为基础镜像，因为当新版本发布时可能导致环境不一致问题。</span></p><pre style=\\\"border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;\\\"><span style=\\\"display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(&quot;https://mmbiz.qpic.cn/mmbiz_svg/OUicWJdJoz3EVP0icdYSluL6ibPu8gGyyppkOaYibPQubxTNicl8Lvra6AT7KZBLm5mufqeo5RKyW6knw9MibdkUU3ACmqjiaEptOkX/640?wx_fmt=svg&amp;from=appmsg&quot;);\\\"></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> FROM python:3.9-alpine</span><br/></div></pre></div></li></ul><h3 style=\\\"margin:0;margin-top:30px;margin-bottom:5px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:left\\\"><span style=\\\"font-size: 16px;color: rgb(231, 142, 52);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: inline-block;\\\"><span>2. </span><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>优化分层</span></strong></span></h3><ul style=\\\"margin:0;list-style-type:disc;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><span>合并指令以减少层数。每个 </span><code style=\\\"height: auto;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);color: rgb(231, 142, 52);font-size: 15px;overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;background-color: rgb(255, 246, 237);font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;\\\"><span>RUN</span></code><span> 指令都会创建新层，最小化层数有助于优化镜像体积。</span></p><pre style=\\\"border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;\\\"><span style=\\\"display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(&quot;https://mmbiz.qpic.cn/mmbiz_svg/OUicWJdJoz3EVP0icdYSluL6ibPu8gGyyppkOaYibPQubxTNicl8Lvra6AT7KZBLm5mufqeo5RKyW6knw9MibdkUU3ACmqjiaEptOkX/640?wx_fmt=svg&amp;from=appmsg&quot;);\\\"></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> RUN apt-get update &amp;&amp; apt-get install -y curl &amp;&amp; apt-get clean</span><br/></div></pre></div></li></ul><h3 style=\\\"margin:0;margin-top:30px;margin-bottom:5px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:left\\\"><span style=\\\"font-size: 16px;color: rgb(231, 142, 52);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: inline-block;\\\"><span>3. </span><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>使用 </span><code><span>.dockerignore</span></code><span> 文件</span></strong></span></h3><ul style=\\\"margin:0;list-style-type:disc;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><span>通过创建 </span><code style=\\\"height: auto;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);color: rgb(231, 142, 52);font-size: 15px;overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;background-color: rgb(255, 246, 237);font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;\\\"><span>.dockerignore</span></code><span> 文件来防止不必要的文件（例如 </span><code style=\\\"height: auto;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);color: rgb(231, 142, 52);font-size: 15px;overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;background-color: rgb(255, 246, 237);font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;\\\"><span>.git</span></code><span>、日志或大型数据集）被包含在构建上下文中：</span></p><pre style=\\\"border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;\\\"><span style=\\\"display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(&quot;https://mmbiz.qpic.cn/mmbiz_svg/OUicWJdJoz3EVP0icdYSluL6ibPu8gGyyppkOaYibPQubxTNicl8Lvra6AT7KZBLm5mufqeo5RKyW6knw9MibdkUU3ACmqjiaEptOkX/640?wx_fmt=svg&amp;from=appmsg&quot;);\\\"></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> node_modules</span><br/><span> *.</span><span style=\\\"color: #e6c07b;line-height: 26px;\\\"><span>log</span></span><br/><span> .git</span><br/></div></pre></div></li></ul><h3 style=\\\"margin:0;margin-top:30px;margin-bottom:5px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:left\\\"><span style=\\\"font-size: 16px;color: rgb(231, 142, 52);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: inline-block;\\\"><span>4. </span><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>保持镜像轻量</span></strong></span></h3><ul style=\\\"margin:0;list-style-type:disc;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><span>使用最小化的基础镜像（如 </span><code style=\\\"height: auto;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);color: rgb(231, 142, 52);font-size: 15px;overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;background-color: rgb(255, 246, 237);font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;\\\"><span>alpine</span></code><span> 或特定语言的 slim 版本）来减小镜像体积。</span></p><pre style=\\\"border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;\\\"><span style=\\\"display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(&quot;https://mmbiz.qpic.cn/mmbiz_svg/OUicWJdJoz3EVP0icdYSluL6ibPu8gGyyppkOaYibPQubxTNicl8Lvra6AT7KZBLm5mufqeo5RKyW6knw9MibdkUU3ACmqjiaEptOkX/640?wx_fmt=svg&amp;from=appmsg&quot;);\\\"></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> FROM node:16-alpine</span><br/></div></pre></div></li></ul><h3 style=\\\"margin:0;margin-top:30px;margin-bottom:5px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:left\\\"><span style=\\\"font-size: 16px;color: rgb(231, 142, 52);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: inline-block;\\\"><span>5. </span><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>添加元数据</span></strong></span></h3><ul style=\\\"margin:0;list-style-type:disc;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><span>使用 </span><code style=\\\"height: auto;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);color: rgb(231, 142, 52);font-size: 15px;overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;background-color: rgb(255, 246, 237);font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;\\\"><span>LABEL</span></code><span> 指令为镜像添加元数据，例如版本、作者和描述：</span></p><pre style=\\\"border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;\\\"><span style=\\\"display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(&quot;https://mmbiz.qpic.cn/mmbiz_svg/OUicWJdJoz3EVP0icdYSluL6ibPu8gGyyppkOaYibPQubxTNicl8Lvra6AT7KZBLm5mufqeo5RKyW6knw9MibdkUU3ACmqjiaEptOkX/640?wx_fmt=svg&amp;from=appmsg&quot;);\\\"></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> LABEL maintainer=</span><span style=\\\"color: #98c379;line-height: 26px;\\\"><span>&quot;yourname@example.com&quot;</span></span><br/><span> LABEL version=</span><span style=\\\"color: #98c379;line-height: 26px;\\\"><span>&quot;1.0&quot;</span></span><br/></div></pre></div></li></ul><h3 style=\\\"margin:0;margin-top:30px;margin-bottom:5px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:left\\\"><span style=\\\"font-size: 16px;color: rgb(231, 142, 52);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: inline-block;\\\"><span>6. </span><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>使用非 root 用户</span></strong></span></h3><ul style=\\\"margin:0;list-style-type:disc;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><span>以 root 身份运行容器存在安全风险。应创建并切换至非 root 用户：</span></p><pre style=\\\"border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;\\\"><span style=\\\"display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(&quot;https://mmbiz.qpic.cn/mmbiz_svg/OUicWJdJoz3EVP0icdYSluL6ibPu8gGyyppkOaYibPQubxTNicl8Lvra6AT7KZBLm5mufqeo5RKyW6knw9MibdkUU3ACmqjiaEptOkX/640?wx_fmt=svg&amp;from=appmsg&quot;);\\\"></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> RUN adduser --disabled-password appuser</span><br/><span> USER appuser</span><br/></div></pre></div></li></ul><h3 style=\\\"margin:0;margin-top:30px;margin-bottom:5px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:left\\\"><span style=\\\"font-size: 16px;color: rgb(231, 142, 52);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: inline-block;\\\"><span>7. </span><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>清理临时文件</span></strong></span></h3><ul style=\\\"margin:0;list-style-type:disc;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><span>安装完成后移除临时文件以减少镜像大小：</span></p><pre style=\\\"border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;\\\"><span style=\\\"display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(&quot;https://mmbiz.qpic.cn/mmbiz_svg/OUicWJdJoz3EVP0icdYSluL6ibPu8gGyyppkOaYibPQubxTNicl8Lvra6AT7KZBLm5mufqeo5RKyW6knw9MibdkUU3ACmqjiaEptOkX/640?wx_fmt=svg&amp;from=appmsg&quot;);\\\"></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> RUN apt-get install -y curl &amp;&amp; rm -rf /var/lib/apt/lists/*</span><br/></div></pre></div></li></ul><hr style=\\\"border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: linear-gradient(to right, rgba(248, 57, 41, 0), rgb(244, 138, 0), rgba(248, 57, 41, 0));background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: 2px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px;margin-top: 20px;margin-right: 0px;margin-bottom: 20px;margin-left: 0px;border-top-width: initial;border-right-width: initial;border-bottom-width: initial;border-left-width: initial;border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-top-color: initial;border-right-color: initial;border-bottom-color: initial;border-left-color: initial;border-image-source: initial;border-image-slice: initial;border-image-width: initial;border-image-outset: initial;border-image-repeat: initial;text-align: center;\\\"/><h2 style=\\\"margin:0;margin-top:30px;margin-bottom:15px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:center;background-position-x:center;background-position-y:center;background-repeat:no-repeat;background-attachment:initial;background-origin:initial;background-clip:initial;background-size:46px\\\"><span style=\\\"display: inline-block;background-size: 100% 100%;background-repeat: no-repeat;width: 28px;height: 28px;margin-bottom: -6px;margin-right: 0px;background-image: url(&quot;https://mmbiz.qpic.cn/sz_mmbiz_gif/vP5B4VX5s6tUlafuLvML6Y8yN2EbOlicPkRa4KCUAUFS6aA2LQ4C0fFQ1zePdsGC2S9eX6GMKYTyX8gPCHaj0vg/640?wx_fmt=gif&amp;from=appmsg&quot;);\\\"></span><span style=\\\"font-size: 18px;color: rgb(231, 142, 52);line-height: 60px;letter-spacing: 0em;text-align: center;font-weight: bold;display: inline-block;height: 46px;background-position-x: left;background-position-y: center;background-repeat: no-repeat;background-attachment: initial;background-origin: initial;background-clip: initial;\\\"><span>8. </span><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>常见错误避免</span></strong></span></h2><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><span>如果编写不当，Dockerfile 会很快变得低效且不安全。以下是一些常见错误及规避方法：</span></p><h3 style=\\\"margin:0;margin-top:30px;margin-bottom:5px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:left\\\"><span style=\\\"font-size: 16px;color: rgb(231, 142, 52);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: inline-block;\\\"><span>1. </span><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>使用大型基础镜像</span></strong></span></h3><ul style=\\\"margin:0;list-style-type:disc;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>问题：</span></strong><span> 使用大型基础镜像会增加构建时间和磁盘占用。</span></p></div></li><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>解决方案：</span></strong><span> 使用轻量级基础镜像，例如 </span><code style=\\\"height: auto;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);color: rgb(231, 142, 52);font-size: 15px;overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;background-color: rgb(255, 246, 237);font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;\\\"><span>alpine</span></code><span> 或语言镜像的精简版。</span></p><pre style=\\\"border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;\\\"><span style=\\\"display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(&quot;https://mmbiz.qpic.cn/mmbiz_svg/OUicWJdJoz3EVP0icdYSluL6ibPu8gGyyppkOaYibPQubxTNicl8Lvra6AT7KZBLm5mufqeo5RKyW6knw9MibdkUU3ACmqjiaEptOkX/640?wx_fmt=svg&amp;from=appmsg&quot;);\\\"></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> FROM python:3.9-alpine</span><br/></div></pre></div></li></ul><h3 style=\\\"margin:0;margin-top:30px;margin-bottom:5px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:left\\\"><span style=\\\"font-size: 16px;color: rgb(231, 142, 52);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: inline-block;\\\"><span>2. </span><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>未能利用多阶段构建</span></strong></span></h3><ul style=\\\"margin:0;list-style-type:disc;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>问题：</span></strong><span> 在最终镜像中包含构建工具会不必要的增加镜像体积。</span></p></div></li><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>解决方案：</span></strong><span> 使用多阶段构建，仅将必要文件复制到生产镜像中。</span></p><pre style=\\\"border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;\\\"><span style=\\\"display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(&quot;https://mmbiz.qpic.cn/mmbiz_svg/OUicWJdJoz3EVP0icdYSluL6ibPu8gGyyppkOaYibPQubxTNicl8Lvra6AT7KZBLm5mufqeo5RKyW6knw9MibdkUU3ACmqjiaEptOkX/640?wx_fmt=svg&amp;from=appmsg&quot;);\\\"></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> FROM golang:1.16 AS builder</span><br/><span> WORKDIR /app</span><br/><span> COPY . .</span><br/><span> RUN go build -o app</span><br/><br/><span> FROM alpine:latest</span><br/><span> COPY --from=builder /app/app /app</span><br/><span> CMD [</span><span style=\\\"color: #98c379;line-height: 26px;\\\"><span>&quot;/app&quot;</span></span><span>]</span><br/></div></pre></div></li></ul><h3 style=\\\"margin:0;margin-top:30px;margin-bottom:5px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:left\\\"><span style=\\\"font-size: 16px;color: rgb(231, 142, 52);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: inline-block;\\\"><span>3. </span><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>硬编码敏感信息</span></strong></span></h3><ul style=\\\"margin:0;list-style-type:disc;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>问题：</span></strong><span> 在 Dockerfile 中存储敏感数据（如 API 密钥或密码）存在安全风险。</span></p></div></li><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>解决方案：</span></strong><span> 使用环境变量或密钥管理工具：</span></p><pre style=\\\"border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;\\\"><span style=\\\"display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(&quot;https://mmbiz.qpic.cn/mmbiz_svg/OUicWJdJoz3EVP0icdYSluL6ibPu8gGyyppkOaYibPQubxTNicl8Lvra6AT7KZBLm5mufqeo5RKyW6knw9MibdkUU3ACmqjiaEptOkX/640?wx_fmt=svg&amp;from=appmsg&quot;);\\\"></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> ENV DB_PASSWORD=</span><span style=\\\"color: #d19a66;line-height: 26px;\\\"><span>${DB_PASSWORD}</span></span><br/></div></pre></div></li></ul><h3 style=\\\"margin:0;margin-top:30px;margin-bottom:5px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:left\\\"><span style=\\\"font-size: 16px;color: rgb(231, 142, 52);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: inline-block;\\\"><span>4. </span><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>安装后未清理</span></strong></span></h3><ul style=\\\"margin:0;list-style-type:disc;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>问题：</span></strong><span> 残留的缓存文件或安装包会导致镜像臃肿。</span></p></div></li><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>解决方案：</span></strong><span> 在同一条 </span><code style=\\\"height: auto;line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);color: rgb(231, 142, 52);font-size: 15px;overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;background-color: rgb(255, 246, 237);font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;\\\"><span>RUN</span></code><span> 指令中清理安装残留：</span></p><pre style=\\\"border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;\\\"><span style=\\\"display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(&quot;https://mmbiz.qpic.cn/mmbiz_svg/OUicWJdJoz3EVP0icdYSluL6ibPu8gGyyppkOaYibPQubxTNicl8Lvra6AT7KZBLm5mufqeo5RKyW6knw9MibdkUU3ACmqjiaEptOkX/640?wx_fmt=svg&amp;from=appmsg&quot;);\\\"></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> RUN apt-get install -y curl &amp;&amp; rm -rf /var/lib/apt/lists/*</span><br/></div></pre></div></li></ul><h3 style=\\\"margin:0;margin-top:30px;margin-bottom:5px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:left\\\"><span style=\\\"font-size: 16px;color: rgb(231, 142, 52);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: inline-block;\\\"><span>5. </span><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>未对 Dockerfile 添加说明</span></strong></span></h3><ul style=\\\"margin:0;list-style-type:disc;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>问题：</span></strong><span> 缺少注释使得他人难以理解特定命令的用途。</span></p></div></li><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>解决方案：</span></strong><span> 添加有意义的注释来解释命令：</span></p><pre style=\\\"border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;text-align: left;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;\\\"><span style=\\\"display: block;background: none;height: 30px;width: 100%;background-size: 40px;background-repeat: no-repeat;background-color: #282c34;margin-bottom: -7px;border-radius: 5px;background-position: 10px 10px;background-image: url(&quot;https://mmbiz.qpic.cn/mmbiz_svg/OUicWJdJoz3EVP0icdYSluL6ibPu8gGyyppkOaYibPQubxTNicl8Lvra6AT7KZBLm5mufqeo5RKyW6knw9MibdkUU3ACmqjiaEptOkX/640?wx_fmt=svg&amp;from=appmsg&quot;);\\\"></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> </span><span style=\\\"color: #5c6370;font-style: italic;line-height: 26px;\\\"><span># Set working directory</span></span><br/><span> WORKDIR /usr/src/app</span><br/></div></pre></div></li></ul><hr style=\\\"border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: linear-gradient(to right, rgba(248, 57, 41, 0), rgb(244, 138, 0), rgba(248, 57, 41, 0));background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: 2px;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px;margin-top: 20px;margin-right: 0px;margin-bottom: 20px;margin-left: 0px;border-top-width: initial;border-right-width: initial;border-bottom-width: initial;border-left-width: initial;border-top-style: none;border-right-style: none;border-bottom-style: none;border-left-style: none;border-top-color: initial;border-right-color: initial;border-bottom-color: initial;border-left-color: initial;border-image-source: initial;border-image-slice: initial;border-image-width: initial;border-image-outset: initial;border-image-repeat: initial;text-align: center;\\\"/><h2 style=\\\"margin:0;margin-top:30px;margin-bottom:15px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:center;background-position-x:center;background-position-y:center;background-repeat:no-repeat;background-attachment:initial;background-origin:initial;background-clip:initial;background-size:46px\\\"><span style=\\\"display: inline-block;background-size: 100% 100%;background-repeat: no-repeat;width: 28px;height: 28px;margin-bottom: -6px;margin-right: 0px;background-image: url(&quot;https://mmbiz.qpic.cn/sz_mmbiz_gif/vP5B4VX5s6tUlafuLvML6Y8yN2EbOlicPkRa4KCUAUFS6aA2LQ4C0fFQ1zePdsGC2S9eX6GMKYTyX8gPCHaj0vg/640?wx_fmt=gif&amp;from=appmsg&quot;);\\\"></span><span style=\\\"font-size: 18px;color: rgb(231, 142, 52);line-height: 60px;letter-spacing: 0em;text-align: center;font-weight: bold;display: inline-block;height: 46px;background-position-x: left;background-position-y: center;background-repeat: no-repeat;background-attachment: initial;background-origin: initial;background-clip: initial;\\\"><span>9. </span><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>结论</span></strong></span></h2><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><span>Dockerfile 是构建高效安全容器的基石。通过掌握 Dockerfile 语法、理解最佳实践并避开常见陷阱，您能简化应用程序容器化流程，实现跨环境的一致部署。</span></p><h3 style=\\\"margin:0;margin-top:30px;margin-bottom:5px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:left\\\"><span style=\\\"font-size: 16px;color: rgb(231, 142, 52);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: inline-block;\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>关键要点：</span></strong></span></h3><ul style=\\\"margin:0;list-style-type:disc;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>从</span><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>最小化基础镜像</span></strong><span>开始，以减小体积并提升性能。</span></div></li><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>利用</span><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>多阶段构建</span></strong><span>来生成生产级镜像。</span></div></li><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>始终</span><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>测试与调试</span></strong><span>你的 Dockerfile 以确保可靠性。</span></div></li><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>实施</span><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>安全最佳实践</span></strong><span> ，例如使用非 root 用户和密钥管理。</span></div></li><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>使用 </span><code style=\\\"line-height: 1.8em;letter-spacing: 0em;background-attachment: scroll;background-clip: border-box;background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgb(0, 0, 0);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);color: rgb(231, 142, 52);font-size: 15px;overflow-wrap: break-word;padding-top: 2px;padding-right: 4px;padding-bottom: 2px;padding-left: 4px;border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;margin-top: 0px;margin-right: 2px;margin-bottom: 0px;margin-left: 2px;background-color: rgb(255, 246, 237);font-family: 'Operator Mono', Consolas, Monaco, Menlo, monospace;word-break: break-all;\\\"><span>.dockerignore</span></code><span> 排除不必要的文件，优化构建上下文。</span></div></li></ul><h3 style=\\\"margin:0;margin-top:30px;margin-bottom:5px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;display:block;text-align:left\\\"><span style=\\\"font-size: 16px;color: rgb(231, 142, 52);line-height: 1.5em;letter-spacing: 0em;text-align: left;font-weight: bold;display: inline-block;\\\"><strong style=\\\"color: rgba(0, 0, 0, 0.85);font-weight: bold;background-attachment: scroll;background-clip: border-box;background-color: rgba(0, 0, 0, 0);background-image: none;background-origin: padding-box;background-position-x: 0%;background-position-y: 0%;background-repeat: no-repeat;background-size: auto;width: auto;height: auto;margin-top: 0px;margin-bottom: 0px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px;border-top-style: none;border-bottom-style: none;border-left-style: none;border-right-style: none;border-top-width: 3px;border-bottom-width: 3px;border-left-width: 3px;border-right-width: 3px;border-top-color: rgba(0, 0, 0, 0.4);border-bottom-color: rgba(0, 0, 0, 0.4);border-left-color: rgba(0, 0, 0, 0.4);border-right-color: rgba(0, 0, 0, 0.4);border-top-left-radius: 0px;border-top-right-radius: 0px;border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\\\"><span>Todo：</span></strong></span></h3><ol style=\\\"margin:0;list-style-type:decimal;margin-top:8px;margin-bottom:8px;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:20px;padding-right:0;color:rgb(231,142,52);font-size:15px\\\"><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>为你的项目尝试编写基础和多阶段的 Dockerfile。</span></div></li><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>应用最佳实践并将调试技术集成到你的工作流程中。</span></div></li><li><div style=\\\"margin-top: 5px;margin-bottom: 5px;word-spacing: 0.1em;color: rgb(1, 1, 1);font-size: 16px;line-height: 1.8em;letter-spacing: 0em;text-align: left;font-weight: normal;\\\"><span>与团队分享你的 Dockerfile 以促进协作和反馈。</span></div></li></ol><p style=\\\"margin:0;color:rgba(0,0,0,0.85);font-size:16px;line-height:1.75;letter-spacing:0.1em;text-align:left;text-indent:0;padding-top:8px;padding-bottom:8px;padding-left:0;padding-right:0;margin-top:5px;margin-right:0;margin-bottom:5px;margin-left:0;word-spacing:0.1em\\\"><span>遵循这份全面指南，你将不仅能构建稳健的 Dockerfile，还能提升作为 DevOps 专业人员的技能，从而为高效的 CI/CD 工作流和可扩展系统做出贡献。</span></p></div><div><span><br/></span></div></div></div></div></div></div></span>\\\n</div></body></html>\\u0000\"]],\"start1\":0,\"start2\":0,\"length1\":0,\"length2\":276451}]"
metadata_diff: {"new":{"id":"11064b9ea1694956926e793d49b5499d","parent_id":"061de1401cfc4cfaadf6e74e015970e9","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":1764345888884,"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-28T16:20:26.793Z
created_time: 2025-11-28T16:20:26.793Z
type_: 13