October 14, 20232 yr I have a custom docker network created with; docker network create -d ipvlan \ --subnet=192.168.100.0/24 \ --gateway=192.168.100.1 \ -o ipvlan_mode=l2 \ -o parent=virbr1 \ --opt com.docker.network.bridge.enable_icc=false \ lab_net virbr1 is a libvirt network used for my VM's. Everything works if it all comes up in the correct order but when I reboot unraid the docker network is created (I have "Preserve user defined networks" enabled) but it doesn't function and the containers using it wont start. I have to remove the network and recreate it again manually (along with the containers using it) before the containers will start. I'm assuming this is because virbr1 probably doesn't exist when unraid starts docker. How can I fix this so it survives a reboot? Edited October 14, 20232 yr by L0k1
October 14, 20232 yr Author 21 hours ago, L0k1 said: I'm assuming this is because virbr1 probably doesn't exist when unraid starts docker. How can I fix this so it survives a reboot? I think I was wrong about this being the problem, if it was then restarting docker when libvirt is already running would solve it, it doesn't. After restarting docker (or rebooting) when I try to start the container it says "server error"; Trying to recreate the container gives me "network id not found"; The network does exist; I have to recreate both the network and container to get it working again.
October 15, 20232 yr Author I've come up with a workaround but my plan was to move all my mission critical containers to this network and this setup seems too fragile to be able to do that. I'm currently running this at start of the array with the userscripts plugin; #!/bin/bash sleep 30 # Define the name of the network network_name="lab_net" subnet="192.168.100.0/24" gateway="192.168.100.1" # Check if the network exists if ! docker network inspect $network_name > /dev/null 2>&1; then echo "Docker network $network_name not found." exit 1 fi # List all containers using the network and make sure they're stopped containers=$(docker ps -a --filter "network=$network_name" --format '{{.Names}}') if [ -z "$containers" ]; then echo "No containers are connected to network $network_name." else for container_name in $containers; do docker stop $container_name echo "Stopped container: $container_name" done fi # Remove the network docker network rm $network_name # Recreate the network docker network create \ -d ipvlan \ --subnet=$subnet \ --gateway=$gateway \ -o ipvlan_mode=l2 \ -o parent=virbr1 \ -o com.docker.network.bridge.enable_icc=false \ $network_name # Connect containers to new network and start if [ -z "$containers" ]; then echo "No containers to start." else for container_name in $containers; do docker network connect $network_name $container_name docker start $container_name echo "Started container: $container_name" done fi Could really do with somebody who knows the unraid internals investigating why the network doesn't work to begin with, I think the proper solution may be to ensure virbr1 gets created before docker comes up. Does unraid start docker before libvirt? Any way to change this behaviour?
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.