extra_hosts参数。
它可以在集成环境中工作,在该组合文件中,preprod主机IP已被集成IP替换,从而在/ etc / hosts中创建了容器并指定了extra_hosts IP列表
容器是通过以下命令创建的:/ home / docker / vol / docker-compose -f /home/docker/vol_shared/docker-compose.yml up -d
我尝试过以下格式:
extra_hosts:
retisdev: 10.48.161.44
retistesting: 10.48.161.44
代替这种格式:
extra_hosts:
- "retisdev=10.48.161.44"
- "retistesting=10.48.161.44"
但不起作用
这是docker-compose.yml文件:
gu-xregime:
image: alm.devptra.fr/docker/prototype:7.9.0
restart: always
container_name: gu-xregime
environment:
APP_BASEPATH: /gu-xregime
npm_package_name: gu-xregime
LANG: fr_FR
volumes:
- /etc/localtime:/etc/localtime
- /home/docker/vol/gu-xregime/conf:/gu-xregime
ports:
- 3011:3000
command: -s gu-xregime -v 1.1.1
logging:
driver: fluentd
options:
fluentd-address: "10.48.161.33:24224"
fluentd-async-connect: "true"
networks:
- docker-bridge
extra_hosts:
- docker-host.devptra.fr:10.48.161.44
答案 0 :(得分:0)
正确的语法是将其作为带有冒号的字符串作为yml数组,例如:
extra_hosts:
- "somehost:162.242.195.82"
- "otherhost:50.31.209.229"
我实际上是从docs复制过来的。