长话短说。我在EBS中正在尝试设置Rabbitmq
单个实例。在本地,一切正常,并且能够通过5672端口连接到RabbitMQ。当我将映像部署到EBS时,似乎Dockerrun.aws.json
的第一个端口已自动绑定到端口80,因此可以通过此端口访问amqp
。
是否存在可以用来将5672端口正确绑定到ec2主机的5672的黑客措施?
Dockerfile
FROM rabbitmq:3.7.7-management-alpine
ADD rabbitmq.config /etc/rabbitmq/
ADD definitions.json /etc/rabbitmq/
EXPOSE 5672
EXPOSE 15672
CMD ["rabbitmq-server"]
Dockerrun.aws.json
{
"AWSEBDockerrunVersion": "1",
"Image": {
"Name": "some-image-name",
"Update": "true"
},
"Ports": [{
"HostPort": "5672",
"ContainerPort": "5672"
},
{
"HostPort": "15672",
"ContainerPort": "15672"
}
],
"Volumes": []
}
答案 0 :(得分:0)
破解很容易。只需将随机端口公开为第一项即可。 现在,其他端口已正确映射。
{
"AWSEBDockerrunVersion": "1",
"Image": {
"Name": "some-image",
"Update": "true"
},
"Ports": [{
"HostPort": "80",
"ContainerPort": "80"
},
{
"HostPort": "5672",
"ContainerPort": "5672"
},
{
"HostPort": "15672",
"ContainerPort": "15672"
}
],
"Volumes": []
}