我知道可以通过extra_hosts
属性将其他条目添加到服务主机列表:
version: '2.1'
networks:
somenet:
external: true
services:
myservice:
image: myimage-
container_name: mycontainername
hostname: myhostname
networks:
- somenet
extra_hosts:
- "otherhost1.com:192.12.136.14"
- "otherhost2.com:192.12.136.15"
现在,我希望能够为整个网络“ somenet”定义extra_hosts。也许像这样:
docker network create somenet --extra-hosts "otherhost1.com:192.12.136.14 otherhost2.com:192.12.136.15"
是否有docker native解决方案?