简体   繁体   English

使用Amazon ECS运行Docker Network

[英]Run Docker Network using Amazon ECS

I have a docker network that I'd like to run on AWS, preferably using the Fargate Launch type . 我有一个要在AWS上运行的docker网络,最好使用Fargate Launch type

Pushing images to the ECR (Elastic Container Registry) is not a problem, but I am not sure how to push a network. 将图像推送到ECR(弹性容器注册表)不是问题,但是我不确定如何推送网络。 I have the following commands to run it locally on my machine: 我有以下命令在计算机上本地运行它:

docker pull zilutian/hadoop
docker pull zilutian/data-analytics
docker network create hadoop-net
docker run -d --net hadoop-net --name master --hostname master zilutian/data-analytics master
docker run -d --net hadoop-net --name slave01 --hostname slave01 zilutian/hadoop slave
docker run -d --net hadoop-net --name slave02 --hostname slave02 zilutian/hadoop slave
docker exec master benchmark

I'm not sure if I need to push the network or the master and slaves? 我不确定是否需要推送网络或主机和从机?

The only thing you can push to ECR (or any other image registry) is the Docker images themselves; 您可以推送到ECR(或任何其他映像注册表)的唯一一件事就是Docker映像本身。 the contents of the zilutian/data-analytics and zilutian/Hadoop images you reference in the docker run command. 您在zilutian/Hadoop docker run命令中引用的zilutian/data-analyticszilutian/Hadoop映像的内容。 You can't push a network, running containers, processes in a container, or anything else. 您不能推送网络,运行容器,容器中的进程或其他任何东西。

90% of this you can encapsulate in a Docker Compose YAML file, which is probably the easiest way to describe this set of images, run commands, and a private network. 您可以将其中的90%封装在Docker Compose YAML文件中,这可能是描述这组映像,运行命令和专用网络的最简单方法。 You can check this file into source control; 您可以将此文件签入源代码管理中。 there is no way to push it to a Docker registry. 没有办法将其推送到Docker注册表。 (Or alternatively you can just check in the file from the question as a shell script and run it.) (或者,您也可以将问题文件作为外壳脚本检入并运行。)

The one thing you can't include in this is the docker exec command. 您不能在其中包含的一件事是docker exec命令。 It's unclear why you'd want to launch a benchmark out of a Hadoop master node; 目前尚不清楚为什么要在Hadoop主节点上启动基准测试。 I would docker run a separate container that's the benchmarking tool, or possibly run it outside of Docker directly from the host or somewhere else you can access the cluster. 我会docker run作为基准测试工具的单独容器,或者可能直接从主机或其他可以访问群集的地方在docker run窗外部运行它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM