我正在从网络上的各种 docker-compose 示例构建我的 docker 容器堆栈,并且在尝试在 docker-compose 文件版本之间“转换”时经常遇到麻烦。
对于这个讨论,我试图“转换” QNAP Container station Qnet 网络驱动程序示例 [1]:
version: '2'
services:
qnet_dhcp:
image: alpine
command: ifconfig eth0
networks:
- qnet-dhcp
qnet_static:
image: alpine
command: ifconfig eth0
networks:
qnet-static:
ipv4_address: 192.168.80.119
networks:
qnet-dhcp:
driver: qnet
ipam:
driver: qnet
options:
iface: "eth0"
qnet-static:
driver: qnet
ipam:
driver: qnet
options:
iface: "eth0"
config:
- subnet: 192.168.80.0/23
gateway: 192.168.80.254
我已经做到了这一点(我无法工作的 qnet-static 部分):
version: "3"
services:
qnet_dhcp:
image: alpine
command: ifconfig eth0
networks:
- qnet-dhcp
networks:
qnet-dhcp:
driver: qnet
driver_opts:
iface: "eth0"
这“编译”,但当我运行它时出现错误(在 QNAP TVS-1282T 上):
[/share/data/appdata] # docker-compose up -d
Creating network "appdata_qnet-dhcp" with driver "qnet"
Creating appdata_qnet_dhcp_1 ... error
ERROR: for appdata_qnet_dhcp_1 Cannot start service qnet_dhcp: failed to create endpoint appdata_qnet_dhcp_1 owork appdata_qnet-dhcp: NetworkDriver.CreateEndpoint: invalid literal for int() with base 16: ''
ERROR: for qnet_dhcp Cannot start service qnet_dhcp: failed to create endpoint appdata_qnet_dhcp_1 on network ta_qnet-dhcp: NetworkDriver.CreateEndpoint: invalid literal for int() with base 16: ''
ERROR: Encountered errors while bringing up the project.
有人可以澄清与此示例相关的 docker-compose 文件版本 2 和版本 3 之间的更改吗?
[1] https://qnap-dev.github.io/container-station-api/qnet.html#docker-compose