[英]Elastic Beanstalk MultiContainer Docker Environment Variables
[英]Elastic Beanstalk Multicontainer Docker environment: no entries in etc/hosts for lined containers
我的環境中有幾個容器。 其中一些鏈接。 當我使用“ docker-compose up -d”運行環境時,它將在etc / hosts中為鏈接的容器創建條目。 當我使用“ eb local run”運行它時,不會創建任何條目。 這是為什么?
我的Dockerrun.aws.json
{
"AWSEBDockerrunVersion": 2,
"containerDefinitions": [
{
"name": "api",
"image": "php7",
"essential": true,
"memory": 128,
"portMappings": [
{
"hostPort": 8080,
"containerPort": 80
}
],
"mountPoints": [
{
"sourceVolume": "api",
"containerPath": "/var/www/html/"
}
]
},
{
"name": "nodeapi",
"image": "nodejs",
"essential": true,
"memory": 256,
"portMappings": [
{
"hostPort": 5000,
"containerPort": 5000
}
],
"mountPoints": [
{
"sourceVolume": "nodeapi",
"containerPath": "/var/www/app/"
}
],
"Logging": "/var/eb_log"
},
{
"name": "proxy",
"image": "nginx",
"essential": true,
"memory": 128,
"links": [
"api",
"nodeapi"
],
"portMappings": [
{
"hostPort": 8443,
"containerPort": 80
}
]
}
]
}
這將生成docker-compose.yml:
api:
image: php7
ports:
- 8080:80
nodeapi:
image: nodejs
ports:
- 5000:5000
proxy:
image: nginx
links:
- api:api
- nodeapi:nodeapi
ports:
- 8443:80
不久前,Docker切換到基於DNS的查找,而不是向/ etc / hosts添加條目。 不建議使用鏈接,而是為容器使用公共網絡。
好的,這是本地問題。 我將Docker和EB cli升級到最新版本,從而解決了該問題。 我不確定為什么EB cli以前無法向etc / hosts添加別名,但是在升級后確實如此。 現在我通過使用“ docker-compose up”或“ eb local run”得到相同的結果。 現在所有鏈接的容器都已鏈接,並且可以正常工作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.