我正在运行几个对接容器,并决定重新组织它们(将配置拆分为收集依赖服务的文件夹,而不是有一个大堆)。在我移动我的家庭助理配置之前,一切都很顺利。
在以前的配置中,我没有更改任何内容,只是强制执行所有可见的“外部”容器(在专用码头网络之外)共同使用的网络。它可以很好地处理20+其他容器。
hass:
devices:
- /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0:/dev/serial/by-id/usb-1a86_USB_Serial-if00-port0
image: homeassistant/home-assistant:2022.7
network_mode: host
restart: unless-stopped
volumes:
- /etc/docker/domotique/data/hass:/config
- /etc/localtime:/etc/localtime:ro
depends_on:
- mqtt
networks:
- srv
(...)
networks:
srv:
external: true
name: srv启动这个容器时,我会得到一个错误:
root@srv /e/d/domotique# docker-compose up hass
[+] Running 1/0
⠿ Container domotique-mqtt-1 Running 0.0s
Attaching to domotique-hass-1
Error response from daemon: failed to add interface veth6eb29e9 to sandbox: error setting interface "veth6eb29e9" IP to 172.18.0.33/16: cannot program address 172.18.0.33/16 in sandbox interface because it conflicts with existing route {Ifindex: 7 Dst: 172.18.0.0/16 Src: 172.18.0.1 Gw: <nil> Flags: [] Table: 254}当我注释掉network_mode: host时,它就消失了。然后正在运行的容器具有IP 172.18.0.33/16。拆下现有的家居助理货柜,以强制进行康乐活动,并无帮助。
在这种情况下,这个信息意味着什么?
发布于 2022-08-07 06:25:00
问题是我使用了network_mode: host,同时设置了要使用的网络(srv)。
删除networks部分解决了这个问题。
https://unix.stackexchange.com/questions/712659
复制相似问题