簡體   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