id: 1fae93058eb044fa993ec83abff8329a
parent_id: 
item_type: 1
item_id: ed339d657509482b88a457ab150d5655
item_updated_time: 1764345491983
title_diff: "[{\"diffs\":[[1,\"Amazon ECS 的 Docker 基本知识 - Amazon Elastic Con\"]],\"start1\":0,\"start2\":0,\"length1\":0,\"length2\":45}]"
body_diff: "[{\"diffs\":[[1,\"<html>\\\r\\\n<head>\\\r\\\n  <title>Amazon ECS 的 Docker 基本知识 - Amazon Elastic Container Service</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  <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=\\\"21447\\\"></a>\\\r\\\n<h1>Amazon ECS 的 Docker 基本知识 - Amazon Elastic Container Service</h1>\\\r\\\n\\\r\\\n<div><span>\\\n  <div>\\\n<div><br/></div><div style=\\\"font-size: 16px; display:block; min-width: 100%;\\\"> <div style=\\\"background-color:transparent;font:inherit;vertical-align:baseline;\\\"><div style=\\\"background-color:transparent;font:inherit;vertical-align:baseline;font-family:&quot;PT Serif&quot;;font-size:16px;line-height:1.5em;color:rgb(31, 9, 9);text-align:left;\\\"><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;\\\"><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;z-index:200;padding-left:2em;padding-right:2em;margin-left:auto;margin-right:auto;position:relative;width:36em;\\\"><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;position:relative;margin-left:-25px;margin-right:25px;\\\"><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;position:relative;padding-top:0px;padding-bottom:9em;\\\"><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\"><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;position:relative;margin-bottom:0px;\\\"><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:0px;\\\"><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:0px;\\\"><h1 style=\\\"border:0px;font:inherit;vertical-align:baseline;font-family:&quot;PT Serif&quot;;text-align:left;font-size:35px;font-weight:normal;line-height:35px;margin-bottom:20px;padding:0px;margin:0px;\\\">Amazon ECS 的 Docker 基本知识 </h1><div style=\\\"padding:0px;border:0px;font:inherit;vertical-align:baseline;position:relative;height:1em;line-height:1;text-align:center;padding-top:1.5em;padding-bottom:1.5em;margin:0px;margin-bottom:0px;\\\"><div style=\\\"padding:0px;border:0px;font:inherit;vertical-align:baseline;position:absolute;left:-4em;top:50%;z-index:10;width:100%;padding-left:4em;padding-right:4em;height:0.1em;opacity:0.5;background:-webkit-linear-gradient(0deg, rgb(243, 242, 238) 1%, rgb(31, 9, 9) 50%, rgb(243, 242, 238) 99%);margin:0px;margin-bottom:0px;\\\"><span style=\\\"font:inherit;position:absolute;left:-4em;top:50%;z-index:10;width:100%;padding-left:4em;padding-right:4em;height:0.1em;margin:0px;opacity:0.5;background:-webkit-linear-gradient(0deg, rgb(243, 242, 238) 1%, rgb(31, 9, 9) 50%, rgb(243, 242, 238) 99%);\\\"></span></div></div></div>\\\n                     <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">Docker 是一项可让您构建、运行、测试和部署基于 Linux 容器的分布式应用程序的技术。 Amazon ECS 使用任务定义中的 Docker 映像来启动群集中的 EC2 实例上的容器。有关 Amazon ECS 产品详细信息、特色客户案例研究和常见问题，请参阅\\\n                           <a href=\\\"http://aws.amazon.com/ecs\\\" style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;color:rgb(6, 85, 136);text-decoration:none;\\\" target=\\\"_blank\\\">Amazon Elastic Container Service 产品详细信息页面</a>。</p>\\\n                     <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">本指南中的文档假定读者已基本了解 Docker 是什么及其工作方式。有关 Docker 的更多信息，请参阅 <a href=\\\"http://aws.amazon.com/docker/\\\" style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;color:rgb(6, 85, 136);text-decoration:none;\\\" target=\\\"_blank\\\">Docker 是什么？</a>和<a href=\\\"https://docs.docker.com/engine/docker-overview/\\\" style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;color:rgb(6, 85, 136);text-decoration:none;\\\" target=\\\"_blank\\\">Docker 概述</a>。\\\n                     </p>\\\n                     \\\n                     \\\n                     <h2 style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:&quot;PT Serif&quot;;text-align:left;font-weight:bold;font-size:30px;line-height:35px;margin-top:35px;margin-bottom:1.5em;\\\">安装 Docker</h2>\\\n                     \\\n                     <div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">\\\n                        <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">注意</p>\\\n                        <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:0px;\\\">如果您已安装 Docker，请跳到<a href=\\\"https://docs.aws.amazon.com/zh_cn/AmazonECS/latest/developerguide/docker-basics.html#docker-basics-create-image\\\" style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;color:rgb(6, 85, 136);text-decoration:none;\\\" target=\\\"_blank\\\">创建 Docker 映像</a>。\\\n                        </p>\\\n                     </div>\\\n                     \\\n                     \\\n                     <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">Docker 适用于许多不同的操作系统，包括大多数现代 Linux 分发版 (如 Ubuntu) 甚至 Mac OSX 和 Windows。有关如何在特定的操作系统上安装\\\n                        Docker 的更多信息，请转到 <a href=\\\"https://docs.docker.com/engine/installation/#installation\\\" style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;color:rgb(6, 85, 136);text-decoration:none;\\\" target=\\\"_blank\\\">Docker 安装指南</a>。\\\n                     </p>\\\n                     \\\n                     <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">您甚至无需本地开发系统即可使用 Docker。如果您已使用 Amazon EC2，则可启动 Amazon Linux 实例并安装 Docker 以开始使用。</p>\\\n                     \\\n                     <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\"><b style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-weight:bold;\\\">在 Amazon Linux 实例上安装 Docker</b></p>\\\n                     <ol style=\\\"padding:0px;border:0px;font:inherit;vertical-align:baseline;margin:0px 0px 1.5em 1.5em;list-style:none;margin-top:-1em;list-style-type:decimal;\\\">\\\n                        <li style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;list-style-type:inherit;list-style-position:outside;\\\">\\\n                           \\\n                           <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:0px;\\\">使用 Amazon Linux AMI 启动实例。有关更多信息，请参阅 <em style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-style:italic;\\\">Amazon EC2 用户指南（适用于 Linux 实例）</em> 中的<a href=\\\"https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/launching-instance.html\\\" style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;color:rgb(6, 85, 136);text-decoration:none;\\\" target=\\\"_blank\\\">启动实例</a>。\\\n                           </p>\\\n                           \\\n                        </li>\\\n                        <li style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;list-style-type:inherit;list-style-position:outside;\\\">\\\n                           \\\n                           <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:0px;\\\">连接到您的实例。有关更多信息，请参阅 <em style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-style:italic;\\\">Amazon EC2 用户指南（适用于 Linux 实例）</em> 中的<a href=\\\"https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstances.html\\\" style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;color:rgb(6, 85, 136);text-decoration:none;\\\" target=\\\"_blank\\\">连接到您的 Linux 实例</a>。\\\n                           </p>\\\n                           \\\n                        </li>\\\n                        <li style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;list-style-type:inherit;list-style-position:outside;\\\">\\\n                           \\\n                           <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">更新实例上已安装的程序包和程序包缓存。</p>\\\n                           <pre style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;background-color:rgb(243, 242, 238);font-family:Inconsolata;width:auto;font-size:0.875em;line-height:1.71429em;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\"><strong style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-weight:bold;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\"><span style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;background-color:rgb(234, 226, 96);transition:background-color 0.4s ease 0s;color:black;font-weight:inherit;font-style:unset;-evernote-highlight:true;\\\" title=\\\"点击以取消高亮显示\\\">sudo yum update -y</span></code></strong></code></pre>\\\n                           </li>\\\n                        <li style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;list-style-type:inherit;list-style-position:outside;\\\">\\\n                           \\\n                           <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">安装最新的 Docker Community Edition 程序包。</p>\\\n                           <pre style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;background-color:rgb(243, 242, 238);font-family:Inconsolata;width:auto;font-size:0.875em;line-height:1.71429em;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\"><strong style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-weight:bold;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\"><span style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;background-color:rgb(234, 226, 96);transition:background-color 0.4s ease 0s;color:black;font-weight:inherit;font-style:unset;-evernote-highlight:true;\\\" title=\\\"点击以取消高亮显示\\\">sudo yum install -y docker</span></code></strong></code></pre>\\\n                           </li>\\\n                        <li style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;list-style-type:inherit;list-style-position:outside;\\\">\\\n                           \\\n                           <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">启动 Docker 服务。</p>\\\n                           <pre style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;background-color:rgb(243, 242, 238);font-family:Inconsolata;width:auto;font-size:0.875em;line-height:1.71429em;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\"><strong style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-weight:bold;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\"><span style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;background-color:rgb(234, 226, 96);transition:background-color 0.4s ease 0s;color:black;font-weight:inherit;font-style:unset;-evernote-highlight:true;\\\" title=\\\"点击以取消高亮显示\\\">sudo service docker start</span></code></strong></code></pre>\\\n                           </li>\\\n                        <li style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;list-style-type:inherit;list-style-position:outside;\\\">\\\n                           \\\n                           <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">将 <code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;font-size:0.875em;line-height:1.71429em;\\\">ec2-user</code> 添加到 <code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;font-size:0.875em;line-height:1.71429em;\\\">docker</code> 组，以便您能够执行 Docker 命令，而无需使用 <code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;font-size:0.875em;line-height:1.71429em;\\\">sudo</code>。\\\n                           </p>\\\n                           <pre style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;background-color:rgb(243, 242, 238);font-family:Inconsolata;width:auto;font-size:0.875em;line-height:1.71429em;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\"><strong style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-weight:bold;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\"><span style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;background-color:rgb(234, 226, 96);transition:background-color 0.4s ease 0s;color:black;font-weight:inherit;font-style:unset;-evernote-highlight:true;\\\" title=\\\"点击以取消高亮显示\\\">sudo usermod -a -G docker ec2-user</span></code></strong></code></pre>\\\n                           </li>\\\n                        <li style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;list-style-type:inherit;list-style-position:outside;\\\">\\\n                           \\\n                           <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:0px;\\\">退出，再重新登录以接受新的 <code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;font-size:0.875em;line-height:1.71429em;\\\">docker</code> 组权限。您可以关闭当前的 SSH 终端窗口并在新终端窗口中重新连接到实例，完成这一过程。您的新 SSH 会话将具有相应的 <code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;font-size:0.875em;line-height:1.71429em;\\\">docker</code> 组权限。\\\n                           </p>\\\n                           \\\n                        </li>\\\n                        <li style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;list-style-type:inherit;list-style-position:outside;\\\">\\\n                           \\\n                           <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">验证 <code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;font-size:0.875em;line-height:1.71429em;\\\">ec2-user</code> 是否能在没有 <code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;font-size:0.875em;line-height:1.71429em;\\\">sudo</code> 的情况下运行 Docker 命令。\\\n                           </p>\\\n                           <pre style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;background-color:rgb(243, 242, 238);font-family:Inconsolata;width:auto;font-size:0.875em;line-height:1.71429em;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\"><strong style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-weight:bold;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\"><span style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;background-color:rgb(234, 226, 96);transition:background-color 0.4s ease 0s;color:black;font-weight:inherit;font-style:unset;-evernote-highlight:true;\\\" title=\\\"点击以取消高亮显示\\\">docker info</span></code></strong></code></pre>\\\n                           <div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:0px;\\\">\\\n                              <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">注意</p>\\\n                              <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\"><span style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;background-color:rgb(234, 226, 96);transition:background-color 0.4s ease 0s;color:black;font-weight:inherit;font-style:unset;-evernote-highlight:true;\\\" title=\\\"点击以取消高亮显示\\\">在某些情况下，您可能需要重新启动实例，以便为 </span><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;font-size:0.875em;line-height:1.71429em;\\\"><span style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;background-color:rgb(234, 226, 96);transition:background-color 0.4s ease 0s;color:black;font-weight:inherit;font-style:unset;-evernote-highlight:true;\\\" title=\\\"点击以取消高亮显示\\\">ec2-user</span></code><span style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;background-color:rgb(234, 226, 96);transition:background-color 0.4s ease 0s;color:black;font-weight:inherit;font-style:unset;-evernote-highlight:true;\\\" title=\\\"点击以取消高亮显示\\\"> 提供访问 Docker 守护程序的权限。如果您看到以下错误消息，请尝试重启您的实例：\\\n                              </span></p><pre style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;background-color:rgb(243, 242, 238);font-family:Inconsolata;width:auto;font-size:0.875em;line-height:1.71429em;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\"><span style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;background-color:rgb(234, 226, 96);transition:background-color 0.4s ease 0s;color:black;font-weight:inherit;font-style:unset;-evernote-highlight:true;\\\" title=\\\"点击以取消高亮显示\\\">Cannot connect to the Docker daemon. Is the docker daemon running on this host?</span></code></pre></div>\\\n                           \\\n                        </li>\\\n                     </ol>\\\n                     \\\n                     \\\n                     <h2 style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:&quot;PT Serif&quot;;text-align:left;font-weight:bold;font-size:30px;line-height:35px;margin-top:35px;margin-bottom:1.5em;\\\">创建 Docker 映像</h2>\\\n                     \\\n                     <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">Amazon ECS 任务定义使用 Docker 映像启动群集中的容器实例上的容器。在本节中，您将创建简单 Web 应用程序的 Docker 映像，并在本地系统或 EC2 实例上测试此映像，然后将此映像推送至容器注册表 (如 Amazon ECR\\\n                        或 Docker Hub)，以便能够在 ECS 任务定义中使用它。\\\n                     </p>\\\n                     \\\n                     <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\"><b style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-weight:bold;\\\">创建简单 Web 应用程序的 Docker 映像</b></p>\\\n                     <ol style=\\\"padding:0px;border:0px;font:inherit;vertical-align:baseline;margin:0px 0px 1.5em 1.5em;list-style:none;margin-top:-1em;list-style-type:decimal;\\\">\\\n                        <li style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;list-style-type:inherit;list-style-position:outside;\\\">\\\n                           \\\n                           <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">创建名为 <code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;font-size:0.875em;line-height:1.71429em;\\\">Dockerfile</code> 的文件。Dockerfile 是一个清单文件，描述了用于 Docker 映像的基本映像以及要安装的项目以及在此项目上运行的内容。有关 Dockerfile 的更多信息，请转到\\\n                              <a href=\\\"https://docs.docker.com/engine/reference/builder/\\\" style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;color:rgb(6, 85, 136);text-decoration:none;\\\" target=\\\"_blank\\\">Dockerfile 参考</a>。\\\n                           </p>\\\n                           <pre style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;background-color:rgb(243, 242, 238);font-family:Inconsolata;width:auto;font-size:0.875em;line-height:1.71429em;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\"><strong style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-weight:bold;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\">touch Dockerfile</code></strong></code></pre>\\\n                           </li>\\\n                        <li style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;list-style-type:inherit;list-style-position:outside;\\\">\\\n                           \\\n                           <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">编辑您刚刚创建的 <code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;font-size:0.875em;line-height:1.71429em;\\\">Dockerfile</code> 并添加以下内容。\\\n                           </p>\\\n                           <pre style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;background-color:rgb(243, 242, 238);font-family:Inconsolata;width:auto;font-size:0.875em;line-height:1.71429em;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\">FROM ubuntu:12.04\\\n\\\n# Install dependencies\\\nRUN apt-get update -y\\\nRUN apt-get install -y apache2\\\n\\\n# Install apache and write hello world message\\\nRUN echo &quot;Hello World!&quot; &gt; /var/www/index.html\\\n\\\n# Configure apache\\\nRUN a2enmod rewrite\\\nRUN chown -R www-data:www-data /var/www\\\nENV APACHE_RUN_USER www-data\\\nENV APACHE_RUN_GROUP www-data\\\nENV APACHE_LOG_DIR /var/log/apache2\\\n\\\nEXPOSE 80\\\n\\\nCMD [&quot;/usr/sbin/apache2&quot;, &quot;-D&quot;,  &quot;FOREGROUND&quot;]</code></pre>\\\n                           <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:0px;\\\">此 Dockerfile 使用 Ubuntu 12.04 映像。<code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;font-size:0.875em;line-height:1.71429em;\\\">RUN</code> 指令将更新包缓存，安装一些适用于 Web 服务器的软件包，然后将“Hello World!”内容写入到 Web 服务器的文档根目录。<code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;font-size:0.875em;line-height:1.71429em;\\\">EXPOSE</code> 指令在容器上公开端口 80，<code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;font-size:0.875em;line-height:1.71429em;\\\">CMD</code> 指令启动 Web 服务器。\\\n                           </p>\\\n                           \\\n                        </li>\\\n                        <li style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;list-style-type:inherit;list-style-position:outside;\\\">\\\n                           \\\n                           <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">从您的 Dockerfile 生成 Docker 映像。</p>\\\n                           \\\n                           <div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">\\\n                              <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">注意</p>\\\n                              <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:0px;\\\">Docker 的某些版本可能需要在以下命令中使用 Dockerfile 完整路径，而不是所示的相对路径。</p>\\\n                           </div>\\\n                           <pre style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;background-color:rgb(243, 242, 238);font-family:Inconsolata;width:auto;font-size:0.875em;line-height:1.71429em;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\"><strong style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-weight:bold;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\">docker build -t hello-world .</code></strong></code></pre>\\\n                           </li>\\\n                        <li style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;list-style-type:inherit;list-style-position:outside;\\\">\\\n                           \\\n                           <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">运行 <b style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-weight:bold;\\\">docker images</b> 以验证是否已正确创建映像。\\\n                           </p>\\\n                           <pre style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;background-color:rgb(243, 242, 238);font-family:Inconsolata;width:auto;font-size:0.875em;line-height:1.71429em;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\"><strong style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-weight:bold;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\">docker images --filter reference=hello-world</code></strong></code></pre>\\\n                           <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">输出:</p>\\\n                           <pre style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;background-color:rgb(243, 242, 238);font-family:Inconsolata;width:auto;font-size:0.875em;line-height:1.71429em;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\">REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE\\\nhello-world         latest              e9ffedc8c286        4 minutes ago       258MB</code></pre>\\\n                           </li>\\\n                        <li style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;list-style-type:inherit;list-style-position:outside;\\\">\\\n                           \\\n                           <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">运行新构建的映像。<code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;font-size:0.875em;line-height:1.71429em;\\\">-p 80:80</code> 选项将容器上公开的端口 80 映射到主机系统上的端口 80。有关 <b style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-weight:bold;\\\">docker run</b> 的更多信息，请转到 <a href=\\\"https://docs.docker.com/engine/reference/run/\\\" style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;color:rgb(6, 85, 136);text-decoration:none;\\\" target=\\\"_blank\\\">Docker 运行参考</a>。\\\n                           </p>\\\n                           <pre style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;background-color:rgb(243, 242, 238);font-family:Inconsolata;width:auto;font-size:0.875em;line-height:1.71429em;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\"><strong style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-weight:bold;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\">docker run -p 80:80 hello-world</code></strong></code></pre>\\\n                           <div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:0px;\\\">\\\n                              <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">注意</p>\\\n                              <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:0px;\\\">来自 Apache Web 服务器的输出将显示在终端窗口中。您可以忽略“<code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;font-size:0.875em;line-height:1.71429em;\\\">Could not reliably determine the server's fully\\\n                                    qualified domain name</code>”消息。\\\n                              </p>\\\n                           </div>\\\n                           \\\n                        </li>\\\n                        <li style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;list-style-type:inherit;list-style-position:outside;\\\">\\\n                           \\\n                           <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">打开浏览器并指向正在运行 Docker 并托管您的容器的服务器。</p>\\\n                           \\\n                           <div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">\\\n                              \\\n                              \\\n                              \\\n                              \\\n                              <ul style=\\\"padding:0px;border:0px;font:inherit;vertical-align:baseline;margin:0px 0px 1.5em 1.5em;list-style:none;list-style-type:disc;\\\">\\\n                                 <li style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;list-style-type:inherit;list-style-position:outside;\\\">\\\n                                    \\\n                                    <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:0px;\\\">如果您使用的是 EC2 实例，这将是服务器的 <b style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-weight:bold;\\\">Public DNS</b> 值，此值与您用于通过 SSH 连接到实例的地址相同。确保实例的安全组允许端口 80 上的入站流量。\\\n                                    </p>\\\n                                    \\\n                                 </li>\\\n                                 <li style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;list-style-type:inherit;list-style-position:outside;\\\">\\\n                                    \\\n                                    <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:0px;\\\">如果您正在本地运行 Docker，可将您的浏览器指向 <a href=\\\"http://localhost/\\\" style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;color:rgb(6, 85, 136);text-decoration:none;\\\" target=\\\"_blank\\\">http://localhost/</a>。\\\n                                    </p>\\\n                                    \\\n                                 </li>\\\n                                 <li style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;list-style-type:inherit;list-style-position:outside;\\\">\\\n                                    \\\n                                    <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">如果您正在 Windows 或 Mac 计算机上使用 <b style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-weight:bold;\\\">docker-machine</b>，请使用 <b style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-weight:bold;\\\">docker-machine ip</b> 命令查找托管 Docker 的 VirtualBox VM 的 IP 地址，并将 <em style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-style:italic;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;font-size:0.875em;line-height:1.71429em;\\\">machine-name</code></em> 替换为您正在使用的 Docker 计算机的名称。\\\n                                    </p>\\\n                                    <pre style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;background-color:rgb(243, 242, 238);font-family:Inconsolata;width:auto;font-size:0.875em;line-height:1.71429em;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\"><strong style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-weight:bold;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\">docker-machine ip <em style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-style:italic;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\">machine-name</code></em></code></strong></code></pre>\\\n                                    </li>\\\n                              </ul>\\\n                           </div>\\\n                           \\\n                           <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:0px;\\\">您应看到一个显示“Hello World!”语句的statement.</p>\\\n                           \\\n                        </li>\\\n                        <li style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;list-style-type:inherit;list-style-position:outside;\\\">\\\n                           \\\n                           <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:0px;\\\">通过键入 <b style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-weight:bold;\\\">Ctrl + c</b> 来停止 Docker 容器。\\\n                           </p>\\\n                           \\\n                        </li>\\\n                     </ol>\\\n                     \\\n                     \\\n                     <h2 style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:&quot;PT Serif&quot;;text-align:left;font-weight:bold;font-size:30px;line-height:35px;margin-top:35px;margin-bottom:1.5em;\\\">(可选) 将您的映像推送至 Amazon Elastic Container Registry</h2>\\\n                     \\\n                     <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">Amazon ECR 是一项托管 AWS Docker 注册表服务。客户可以使用熟悉的 Docker CLI 推送、拉取和管理映像。有关 Amazon ECR 产品详细信息、特色客户案例研究和常见问题，请参阅\\\n                        <a href=\\\"http://aws.amazon.com/ecr\\\" style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;color:rgb(6, 85, 136);text-decoration:none;\\\" target=\\\"_blank\\\">Amazon Elastic Container Registry 产品详细信息页面</a>。\\\n                     </p>\\\n                     \\\n                     <div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">\\\n                        <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">注意</p>\\\n                        <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:0px;\\\">此部分需要 AWS CLI。如果您的系统尚未安装 AWS CLI，请参阅 <em style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-style:italic;\\\">AWS Command Line Interface 用户指南</em> 中的<a href=\\\"https://docs.aws.amazon.com/cli/latest/userguide/installing.html\\\" style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;color:rgb(6, 85, 136);text-decoration:none;\\\" target=\\\"_blank\\\">安装 AWS 命令行界面</a>。\\\n                        </p>\\\n                     </div>\\\n                     \\\n                     <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\"><b style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-weight:bold;\\\">标记映像并将其推送至 Amazon ECR</b></p>\\\n                     <ol style=\\\"padding:0px;border:0px;font:inherit;vertical-align:baseline;margin:0px 0px 1.5em 1.5em;list-style:none;margin-top:-1em;list-style-type:decimal;\\\">\\\n                        <li style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;list-style-type:inherit;list-style-position:outside;\\\">\\\n                           \\\n                           <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">创建用于存储您的 <code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;font-size:0.875em;line-height:1.71429em;\\\">hello-world</code> 映像的 Amazon ECR 存储库。在输出中记下 <code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;font-size:0.875em;line-height:1.71429em;\\\">repositoryUri</code>。\\\n                           </p>\\\n                           <pre style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;background-color:rgb(243, 242, 238);font-family:Inconsolata;width:auto;font-size:0.875em;line-height:1.71429em;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\"><strong style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-weight:bold;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\">aws ecr create-repository --repository-name hello-world</code></strong></code></pre>\\\n                           <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">输出:</p>\\\n                           <pre style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;background-color:rgb(243, 242, 238);font-family:Inconsolata;width:auto;font-size:0.875em;line-height:1.71429em;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\">{\\\n    &quot;repository&quot;: {\\\n        &quot;registryId&quot;: &quot;<em style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-style:italic;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\">aws_account_id</code></em>&quot;,\\\n        &quot;repositoryName&quot;: &quot;hello-world&quot;,\\\n        &quot;repositoryArn&quot;: &quot;arn:aws:ecr:us-east-1:<em style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-style:italic;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\">aws_account_id</code></em>:repository/hello-world&quot;,\\\n        &quot;createdAt&quot;: 1505337806.0,\\\n        &quot;repositoryUri&quot;: &quot;<em style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-style:italic;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\">aws_account_id</code></em>.dkr.ecr.us-east-1.amazonaws.com/hello-world&quot;\\\n    }\\\n}</code></pre>\\\n                           </li>\\\n                        <li style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;list-style-type:inherit;list-style-position:outside;\\\">\\\n                           \\\n                           <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">使用上一步中的 <code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;font-size:0.875em;line-height:1.71429em;\\\">repositoryUri</code> 值标记 <code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;font-size:0.875em;line-height:1.71429em;\\\">hello-world</code> 映像。\\\n                           </p>\\\n                           <pre style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;background-color:rgb(243, 242, 238);font-family:Inconsolata;width:auto;font-size:0.875em;line-height:1.71429em;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\"><strong style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-weight:bold;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\">docker tag hello-world <em style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-style:italic;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\">aws_account_id</code></em>.dkr.ecr.<em style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-style:italic;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\">us-east-1</code></em>.amazonaws.com/hello-world</code></strong></code></pre>\\\n                           </li>\\\n                        <li style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;list-style-type:inherit;list-style-position:outside;\\\">\\\n                           \\\n                           <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">运行 <b style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-weight:bold;\\\">aws ecr get-login --no-include-email</b> 命令以获取您的注册表的 <b style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-weight:bold;\\\">docker login</b> 身份验证命令字符串。 \\\n                           </p>\\\n                           \\\n                           <div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">\\\n                              <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">注意</p>\\\n                              <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:0px;\\\">AWS CLI 从版本 1.9.15 开始提供 <b style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-weight:bold;\\\">get-login</b> 命令；但对于较新的 Docker 版本 (17.06 或更高版本)，我们建议使用 1.11.91 或更高版本。您可以使用 <b style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-weight:bold;\\\">aws --version</b> 命令查看 AWS CLI 的版本。如果您使用的是 Docker 17.06 或更高版本，请在 <code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;font-size:0.875em;line-height:1.71429em;\\\">get-login</code> 后包含 <code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;font-size:0.875em;line-height:1.71429em;\\\">--no-include-email</code> 选项。如果收到 <code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;font-size:0.875em;line-height:1.71429em;\\\">Unknown options: --no-include-email</code> 错误，请安装最新版本的 AWS CLI。有关更多信息，请参阅 <em style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-style:italic;\\\">AWS Command Line Interface 用户指南</em> 中的<a href=\\\"https://docs.aws.amazon.com/cli/latest/userguide/installing.html\\\" style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;color:rgb(6, 85, 136);text-decoration:none;\\\" target=\\\"_blank\\\">安装 AWS 命令行界面</a>。\\\n                              </p>\\\n                           </div>\\\n                           <pre style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;background-color:rgb(243, 242, 238);font-family:Inconsolata;width:auto;font-size:0.875em;line-height:1.71429em;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\"><strong style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-weight:bold;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\">aws ecr get-login --no-include-email</code></strong></code></pre>\\\n                           </li>\\\n                        <li style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;list-style-type:inherit;list-style-position:outside;\\\">\\\n                           \\\n                           <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">运行上一步中返回的 <b style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-weight:bold;\\\">docker login</b> 命令。此命令提供一个在 12 小时内有效的授权令牌。\\\n                           </p> \\\n                           <div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:0px;\\\">\\\n                              <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">重要</p>\\\n                              <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:0px;\\\">在您执行此 <b style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-weight:bold;\\\">docker login</b> 命令时，系统上的其他用户可以在进程列表 (<b style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-weight:bold;\\\">ps -e</b>) 显示中看到该命令字符串。由于 <b style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-weight:bold;\\\">docker login</b> 命令包含身份验证凭证，因此系统上的其他用户可按此方式查看凭证会带来风险。他们可能会使用凭证获取对您的存储库的推送和拉取访问权限。如果您所在的系统不安全，则应考虑此风险，并通过省略\\\n                                 <code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;font-size:0.875em;line-height:1.71429em;\\\">-p <em style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-style:italic;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;font-size:0.875em;line-height:1.71429em;\\\">password</code></em></code> 选项并在系统提示时输入密码来以交互方式登录。\\\n                              </p>\\\n                           </div> \\\n                        </li>\\\n                        <li style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;list-style-type:inherit;list-style-position:outside;\\\">\\\n                           \\\n                           <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">使用上一步中的 <code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;font-size:0.875em;line-height:1.71429em;\\\">repositoryUri</code> 值将映像推送至 Amazon ECR。\\\n                           </p>\\\n                           <pre style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;background-color:rgb(243, 242, 238);font-family:Inconsolata;width:auto;font-size:0.875em;line-height:1.71429em;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\"><strong style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-weight:bold;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\">docker push <em style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-style:italic;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\">aws_account_id</code></em>.dkr.ecr.<em style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-style:italic;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\">us-east-1</code></em>.amazonaws.com/hello-world</code></strong></code></pre>\\\n                           </li>\\\n                     </ol>\\\n                     \\\n                     \\\n                     <h2 style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:&quot;PT Serif&quot;;text-align:left;font-weight:bold;font-size:30px;line-height:35px;margin-top:35px;margin-bottom:1.5em;\\\">后续步骤</h2>\\\n                     \\\n                     \\\n                     \\\n                     \\\n                     \\\n                     <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">在完成映像推送后，您可以在 Amazon ECS 任务定义中使用可用于运行任务的映像。</p>\\\n                     \\\n                     <div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">\\\n                        <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">注意</p>\\\n                        <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:0px;\\\">此部分需要 AWS CLI。如果您尚未在系统中安装 AWS CLI，请参阅 <em style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-style:italic;\\\">AWS Command Line Interface 用户指南</em> 中的<a href=\\\"https://docs.aws.amazon.com/cli/latest/userguide/installing.html\\\" style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;color:rgb(6, 85, 136);text-decoration:none;\\\" target=\\\"_blank\\\">安装 AWS 命令行界面</a>。\\\n                        </p>\\\n                     </div>\\\n                     \\\n                     <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\"><b style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-weight:bold;\\\">使用 <code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;font-size:0.875em;line-height:1.71429em;\\\">hello-world</code> 映像注册任务定义</b></p>\\\n                     <ol style=\\\"padding:0px;border:0px;font:inherit;vertical-align:baseline;margin:0px 0px 1.5em 1.5em;list-style:none;margin-top:-1em;list-style-type:decimal;\\\">\\\n                        <li style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;list-style-type:inherit;list-style-position:outside;\\\">\\\n                           \\\n                           <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">使用以下内容创建名为 <code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;font-size:0.875em;line-height:1.71429em;\\\">hello-world-task-def.json</code> 的文件，同时用上一部分中的 <code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;font-size:0.875em;line-height:1.71429em;\\\">repositoryUri</code> 替代 <code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;font-size:0.875em;line-height:1.71429em;\\\">image</code> 字段。\\\n                           </p>\\\n                           <pre style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;background-color:rgb(243, 242, 238);font-family:Inconsolata;width:auto;font-size:0.875em;line-height:1.71429em;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\">{\\\n    &quot;family&quot;: &quot;hello-world&quot;,\\\n    &quot;containerDefinitions&quot;: [\\\n        {\\\n            &quot;name&quot;: &quot;hello-world&quot;,\\\n            &quot;image&quot;: &quot;<em style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-style:italic;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\">aws_account_id</code></em>.dkr.ecr.<em style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-style:italic;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\">us-east-1</code></em>.amazonaws.com/hello-world&quot;,\\\n            &quot;cpu&quot;: 10,\\\n            &quot;memory&quot;: 500,\\\n            &quot;portMappings&quot;: [\\\n                {\\\n                    &quot;containerPort&quot;: 80,\\\n                    &quot;hostPort&quot;: 80\\\n                }\\\n            ],\\\n            &quot;entryPoint&quot;: [\\\n                &quot;/usr/sbin/apache2&quot;,\\\n                &quot;-D&quot;,\\\n                &quot;FOREGROUND&quot;\\\n            ],\\\n            &quot;essential&quot;: true\\\n        }\\\n    ]\\\n}</code></pre>\\\n                           </li>\\\n                        <li style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;list-style-type:inherit;list-style-position:outside;\\\">\\\n                           \\\n                           <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">使用 <code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;font-size:0.875em;line-height:1.71429em;\\\">hello-world-task-def.json</code> 文件注册任务定义。\\\n                           </p>\\\n                           <pre style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;background-color:rgb(243, 242, 238);font-family:Inconsolata;width:auto;font-size:0.875em;line-height:1.71429em;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\"><strong style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-weight:bold;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\">aws ecs register-task-definition --cli-input-json file://hello-world-task-def.json</code></strong></code></pre>\\\n                           <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:0px;\\\">任务定义已在 <code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;font-size:0.875em;line-height:1.71429em;\\\">hello-world</code> 系列中注册，如 JSON 文件中所定义。\\\n                           </p>\\\n                           \\\n                        </li>\\\n                     </ol>\\\n                     \\\n                     <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\"><b style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-weight:bold;\\\">使用 <code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;font-size:0.875em;line-height:1.71429em;\\\">hello-world</code> 任务定义运行任务</b></p>\\\n                     <div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">\\\n                        <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">重要</p>\\\n                        <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:0px;\\\">您需要先将容器实例启动到默认集群中，然后才能在 Amazon ECS 中运行任务。有关如何设置和启动容器实例的更多信息，请参阅<a href=\\\"https://docs.aws.amazon.com/zh_cn/AmazonECS/latest/developerguide/get-set-up-for-amazon-ecs.html\\\" style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;color:rgb(6, 85, 136);text-decoration:none;\\\" target=\\\"_blank\\\">Amazon ECS 的设置</a>和 <a href=\\\"https://docs.aws.amazon.com/zh_cn/AmazonECS/latest/developerguide/ECS_GetStarted.html\\\" style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;color:rgb(6, 85, 136);text-decoration:none;\\\" target=\\\"_blank\\\">通过 Fargate 开始使用 Amazon ECS</a>。\\\n                        </p>\\\n                     </div>\\\n                     <ul style=\\\"padding:0px;border:0px;font:inherit;vertical-align:baseline;margin:0px 0px 1.5em 1.5em;list-style:none;list-style-type:disc;\\\">\\\n                        <li style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;list-style-type:inherit;list-style-position:outside;\\\">\\\n                           \\\n                           <p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">使用以下 AWS CLI 命令以通过 <code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;font-size:0.875em;line-height:1.71429em;\\\">hello-world</code> 任务定义运行任务。\\\n                           </p>\\\n                           <pre style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;background-color:rgb(243, 242, 238);font-family:Inconsolata;width:auto;font-size:0.875em;line-height:1.71429em;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\"><strong style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-weight:bold;\\\"><code style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-family:Inconsolata;line-height:1.71429em;font-size:1.15em;\\\">aws ecs run-task --task-definition hello-world</code></strong></code></pre>\\\n                           </li>\\\n                     </ul>\\\n                     \\\n                  </div></div></div><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;position:absolute;top:-1000px;left:-1000px;\\\">Measure</div><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;position:absolute;top:-1000px;left:-1000px;line-height:1;margin-bottom:0px;\\\">Measure</div></div></div></div></div></div></div></div>\\\n</div>\\\n</span>\\\n</div></body></html>\\u0000\"]],\"start1\":0,\"start2\":0,\"length1\":0,\"length2\":58525}]"
metadata_diff: {"new":{"id":"ed339d657509482b88a457ab150d5655","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":1764345716034,"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:12:32.746Z
created_time: 2025-11-28T16:12:32.746Z
type_: 13