"" نسخة عامل الميناء
إصدار docker-compose 1.11.2 ، إنشاء dfed245
إصدار docker-py: 2.1.0
إصدار CPython: 2.7.5
إصدار OpenSSL: OpenSSL 1.0.1e-fips 11 فبراير 2013
```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" عبارة عن سلسلة (في هذه الحالة ، "IntNet") ، فإنه يتوقع أن تكون جميع العناصر سلسلة.
هل من الممكن تغيير "services.xxx.networks" لتوقع tuple؟
في الواقع ، هذا التكوين الثاني غير صحيح أيضًا. networks
إما قائمة سلاسل أو تعيين (هذا هو اسم YAML لـ python dict
). 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: {}
رائع هذا يعمل. شكرا جزيلا لك :)
التعليق الأكثر فائدة
في الواقع ، هذا التكوين الثاني غير صحيح أيضًا.
networks
إما قائمة سلاسل أو تعيين (هذا هو اسم YAML لـ pythondict
). https://docs.docker.com/compose/compose-file/compose-file-v2/#networksعلى سبيل المثال ، إليك تنسيق صالح للتكوين الذي تريده: