简体   繁体   English

从Docker容器中获取映射端口

[英]Obtaining mapped port from within docker container

I'm using Cloudfront and ECS to run tasks within AWS. 我正在使用Cloudfront和ECS在AWS中运行任务。 I map my tasks to random host ports using the following command: 我使用以下命令将任务映射到随机主机端口:

      PortMappings:
        - HostPort: 0
          ContainerPort: 8080

I need to know, within the container, the DN of the host and the random port the task was mapped to. 我需要知道容器内主机的DN和任务映射到的随机端口。 How can I achieve this? 我该如何实现?

According to the documentation , 根据文档

After a task reaches the RUNNING status, manual and automatic host and container port assignments are visible in the Network Bindings section of a container description of a selected task in the Amazon ECS console, or the networkBindings section [of] DescribeTasks responses. 任务达到RUNNING状态后,可以在Amazon ECS控制台中所选任务的容器描述的Network Bindings部分的Network Bindings部分或DescribeTasks响应的networkBindings部分中看到手动和自动的主机和容器端口分配。

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

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