Hi,
I have some containers started on a macvlan network.
Suddenly (I assume after an update, but I’m not sure), my Docker installation has started to behave in a strange way: the containers are running, but not marked as started (they are not shown in docker ps
, but only in docker ps -a
) and I have errors regarding MAC address assignments.
How I create the network:
#!/bin/bash
docker network create -d macvlan \
--subnet=10.42.20.0/24 \
--ip-range=10.42.20.16/29 \
--gateway=10.42.20.1 \
--aux-address 'host=10.42.20.23' \
-o parent=br.iot hassio
ip link add hassio-shim link br.iot type macvlan mode bridge
ip addr add 10.42.20.23/32 dev hassio-shim
ip link set hassio-shim up
ip route add 10.42.20.16/29 dev hassio-shim
My docker-compose file:
version: '3'
networks:
hassio:
external: true
services:
homeassistant:
container_name: home-assistant
image: homeassistant/home-assistant:stable
networks:
hassio:
ipv4_address: 10.42.20.20
restart: always
volumes:
- /homeassistant/config:/config
- /etc/localtime:/etc/localtime:ro
privileged: true
ports:
- "8123:8123"
hass-mosquitto:
container_name: hass-mosquitto
image: eclipse-mosquitto
networks:
hassio:
ipv4_address: 10.42.20.19
restart: always
volumes:
- /homeassistant/mosquitto/config:/mosquitto/config
- /homeassistant/mosquitto/data:/mosquitto/data
- /homeassistant/mosquitto/log:/mosquitto/log
- /etc/localtime:/etc/localtime:ro
ports:
- "1883:1883"
- "9001:9001"
node-red:
build: /homeassistant/hass-node-red-dockerfile
container_name: "hass-node-red"
environment:
- TZ=Europe/Rome
networks:
hassio:
ipv4_address: 10.42.20.18
restart: always
ports:
- "1880:1880"
volumes:
- /homeassistant/nodered/data:/data
- /etc/localtime:/etc/localtime:ro
The errors:
Sep 09 19:28:47 timo docker-compose[9756]: ERROR: for homeassistant Cannot start service homeassistant: OCI runtime create failed: container_linux.go:349: starting container process caused "process_linux.go:449: container init caused \"process_linux.go:432: running prestart hook 0 caused \\\"error running hook: exit status 1, stdout: , stderr: time=\\\\\\\"2021-09-09T19:28:46Z\\\\\\\" level=fatal msg=\\\\\\\"failed to add interface veth772aa53 to sandbox: error setting interface \\\\\\\\\\\\\\\"veth772aa53\\\\\\\\\\\\\\\" MAC to \\\\\\\\\\\\\\\"02:42:0a:2a:14:14\\\\\\\\\\\\\\\": address already in use\\\\\\\"\\\\n\\\"\"": unknown
Sep 09 19:28:47 timo docker-compose[9756]: ERROR: for node-red Cannot start service node-red: OCI runtime create failed: container_linux.go:349: starting container process caused "process_linux.go:449: container init caused \"process_linux.go:432: running prestart hook 0 caused \\\"error running hook: exit status 1, stdout: , stderr: time=\\\\\\\"2021-09-09T19:28:47Z\\\\\\\" level=fatal msg=\\\\\\\"failed to add interface veth0d5deab to sandbox: error setting interface \\\\\\\\\\\\\\\"veth0d5deab\\\\\\\\\\\\\\\" MAC to \\\\\\\\\\\\\\\"02:42:0a:2a:14:12\\\\\\\\\\\\\\\": address already in use\\\\\\\"\\\\n\\\"\"": unknown
Sep 09 19:28:47 timo docker-compose[9756]: ERROR: for hass-mosquitto Cannot start service hass-mosquitto: OCI runtime create failed: container_linux.go:349: starting container process caused "process_linux.go:449: container init caused \"process_linux.go:432: running prestart hook 0 caused \\\"error running hook: exit status 1, stdout: , stderr: time=\\\\\\\"2021-09-09T19:28:47Z\\\\\\\" level=fatal msg=\\\\\\\"failed to add interface veth8622781 to sandbox: error setting interface \\\\\\\\\\\\\\\"veth8622781\\\\\\\\\\\\\\\" MAC to \\\\\\\\\\\\\\\"02:42:0a:2a:14:13\\\\\\\\\\\\\\\": address already in use\\\\\\\"\\\\n\\\"\"": unknown
In dmesg I see:
[ 3355.801447] eth0: renamed from vethc5c562d
[ 3355.821281] vethc5c562d: renamed from eth0
[ 3355.966538] eth0: renamed from veth1b4c44b
[ 3355.989412] veth1b4c44b: renamed from eth0
[ 3356.967547] eth0: renamed from veth493e1b2
[ 3356.985422] veth493e1b2: renamed from eth0
Any idea about why this is happening? Do I have to add some capabilities to my containers?
Thanks in advance!