amazon-web-services - 动态访问主机端口并将其设置为aws中的DockerLabels

标签 amazon-web-services docker aws-cloudformation amazon-ecs

我正在尝试访问主机端口并将其设置为dockerLabels,同时定义云形成,如下所示:

"dockerLabels": {"SERVICE_PORT": "${service_port}"},
"portMappings": [
  {
    "containerPort": {
        "Ref": "ContainerPort"
    },
    "hostPort": ${service_port}
  }
],

我稍后尝试通过 aws-sdk 访问这些端口以进行服务发现。

最佳答案

服务端口是动态的,Cloudformation 无法跟上不断变化的值。如果您可以使用静态端口,请将其声明为 cfn 参数并在代码片段中引用它。然后,您可以在服务发现设置中使用该端口

关于amazon-web-services - 动态访问主机端口并将其设置为aws中的DockerLabels,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50876118/

相关文章:

java - 无法连接到 Dockerfile 中的 Wildfly

aws-cloudformation - ECS 和应用程序负载均衡器

python - 在 Cloudformation 中使用时无法从 S3 下载引导文件

amazon-web-services - AWS 无服务器应用程序模型 (SAM) — 如何更改 StageName?

c# - 使用 CDK : Internal Server Error 使用容器镜像部署 .NET 5 AWS Lambda

amazon-web-services - 自动从 S3 中删除旧备份并每月移动到冰川

amazon-web-services - cfn-signal UPDATE_ROLLBACK_COMPLETE 状态且无法发出信号

amazon-web-services - Route53 和 Cloudfront 请求无法满足?

docker - 您如何在遇到第一个错误时取消构建的 dockerfile 镜像?

docker - Concourse 将文件添加到 docker 镜像一次