【发布时间】:2015-11-05 06:01:08
【问题描述】:
事情是这样的,我需要告诉 Docker 不要容器化容器的网络,因为它需要连接到 VPN(企业私有数据库)内的 MongoDB。
有一个 Docker 命令可以让我做到这一点:--net=host。参考here。
因此,例如,在我的本地机器上运行容器时,我会执行以下操作:
docker run --rm -it --net=host [image-name]:[version] bash -il
这个命令就可以解决问题。多亏了这一点,我才能连接到“私人”MongoDB。
所以,我的问题是:有没有办法在 Elastic Beanstalk 上自定义单个 Docker 环境的 docker run 命令,以便我可以添加 --net=host?
我尝试使用container_commands 到config.yml 文件中添加该指令,但我认为这不能满足我的需要,这是一个sn-p:
container_commands:
00-test_command:
command: bundle exec thin --net=host
01-networking-fix:
command: "docker run --rm -it --net=host [image-name]:[version] bash -il"
【问题讨论】:
标签: amazon-web-services docker amazon-ec2 amazon-elastic-beanstalk