`` `docker-compose version
docker-composeバージョン1.11.2、ビルドdfed245
docker-pyバージョン:2.1.0
CPythonバージョン:2.7.5
OpenSSLバージョン:OpenSSL 1.0.1e-fips 2013年2月11日
```uname -srvmpio
Linux 3.10.0-514.6.1.el7.x86_64 #1 SMP Wed Jan 18 13:06:36 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux```
version: '2.1'
services:
xxx:
image: xxx:latest
networks:
- ExtNet:
ipv4_address: 192.168.1.11
- IntNet
networks:
ExtNet:
driver: macvlan
driver_opts:
parent: enp3s0
ipam:
config:
- gateway: 192.168.1.1
ip_range: 192.168.1.10/28
subnet: 192.168.1.0/24
IntNet:
internal: True
driver: bridge
ipam:
config:
- ip_range: 10.0.0.0/16
subnet: 10.0.0.0/16
services.xxx.networks contains {"ExtNet": {"ipv4_address": "192.168.1.11"}}, which is an invalid type, it should be a string
# Tried docker compose yaml version 2.0, 2.1 and 3.0.
services:
xxx:
image: xxx:latest
networks:
- ExtNet:
ipv4_address: 192.168.1.11
「services.xxx.networks」の項目の1つが文字列(この場合は「IntNet」)である場合、すべての項目が文字列であると想定しているようです。
タプルを期待するように「services.xxx.networks」を変更することは可能でしょうか?
実際、その2番目の構成も正しくありません。 networks
は、文字列のリストまたはマッピングのいずれかです(これは、Pythonのdict
に対するYAMLの名前です)。 https://docs.docker.com/compose/compose-file/compose-file-v2/#networks
たとえば、目的の構成の有効な形式は次のとおりです。
services:
xxx:
image: xxx:latest
networks:
ExtNet:
ipv4_address: 192.168.1.11
IntNet: {}
かっこいい。 どうもありがとうございます :)
最も参考になるコメント
実際、その2番目の構成も正しくありません。
networks
は、文字列のリストまたはマッピングのいずれかです(これは、Pythonのdict
に対するYAMLの名前です)。 https://docs.docker.com/compose/compose-file/compose-file-v2/#networksたとえば、目的の構成の有効な形式は次のとおりです。