繁体   English   中英

ECS Fargate 额外主机

[英]ECS Fargate Extra Hosts

我正在从 EC2 切换到 ECS Fargate 来托管我的 laravel api,我正在使用 laravel 护照 oauth 功能和 guzzle 来生成访问令牌。 但是,为了使其正常工作,我必须在我的 docker-compose.yml 中向 extra_hosts 添加一个条目,例如 example.com:10.20.10.140。

看起来我无法通过 Fargate 添加额外的主机条目,如果有人知道此问题的替代解决方案,我将非常感激,因为该应用程序在本地和 ec2 上都可以正常工作。

谢谢

我过去解决类似限制的方法(例如对我来说是searchdomain )是在启动脚本中添加一行来破解本地文件。 这就是我所做的:

#!/bin/bash

# when the variable is populated a search domain entry is added to resolv.conf at startup
# this is needed for the ECS service discovery given the app works by calling host names and not FQDNs
# a search domain can't be added to the container when using the awsvpc mode 
# and the awsvpc mode is needed for A records (bridge only supports SRV records)
if [ $SEARCH_DOMAIN ]; then echo "search ${SEARCH_DOMAIN}" >> /etc/resolv.conf; fi 

ruby /app/yelb-appserver.rb -o 0.0.0.0

链接到源

如果您不想更改主容器/应用程序来执行此操作,您可以在同一任务中使用一个 sidecar 容器,它只执行此操作然后退出。

暂无
暂无

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

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