![](/img/trans.png)
[英]Elastic Beanstalk MultiContainer Docker Environment Variables
[英]Connection refused for container in multicontainer Docker environment on Elastic Beanstalk
我想在 Elastic beanstalk 上部署一個 tomcat 容器作為多容器環境的一部分。
在本地一切正常
docker run -it --rm -p 8888:8080 tomcat:9.0
When opening http://localhost:8888/
in the browser, the HTTP status 404 with footer Apache Tomcat/9.0.34
appears which is expected because I'm using the official image that doesn't come with any services (that I'我知道)。
現在我想將此容器用作彈性 beantalk 集群中的接入點。
我 select Create Application
並提供我的 Dockerrun.aws.json¹:
{
"AWSEBDockerrunVersion": 2,
"volumes": [],
"containerDefinitions": [
{
"name": "vanilla-tomcat",
"image": "tomcat:9.0",
"essential": "true",
"memory": 128,
"portMappings": [
{
"hostPort": 8888,
"containerPort": 8080
}
],
"mountPoints": []
}
]
}
健康是綠色的,沒有錯誤,但是當我調用地址時,例如
與curl http://vanillatomcat-env.eba-abc.eu-central-1.elasticbeanstalk.com/
我得到curl: (7) Failed to connect to vanillatomcat-env.eba-xy.eu-central-1.elasticbeanstalk.com port 80: Connection refused
與curl http://vanillatomcat-env.eba-abc.eu-central-1.elasticbeanstalk.com:8888
Connection timed out
。
安全組有一個入站規則:
Type Protocol Port range Source Description - optional
HTTP TCP 80 0.0.0.0/0 -
我需要配置什么才能訪問我的容器?
¹我故意只提供一個容器以保持簡單,但其他環境不是解決方案,它必須是多容器環境!
進步
aws:elasticbeanstalk:environment:process:default:Port
設置為不同的值: 但這並沒有改變調用address
或address:1234
poroko/flask-demo-app
, containerPort
是 5000。它再次在本地工作( docker run -it --rm -p 8888:5000 poroko/flask-demo-app
),但不是在彈性豆莖上,所以我認為這個問題不是特定於 tomcat 而是由於設置。設置"hostPort": 80
為我解決了這個問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.