While looking at the Netowrking tab, I had the (not so) brilliant idea of making vb-docker a member of br0.
that in itself didn’t break anything, but when I used dockge to create a new container, I was greeted with:
Error response from daemon: failed to create endpoint debian-debian-1 on network debian_default: adding interface vethb7d8899 to bridge br-78f70e66f3ba failed: Device does not exist
I set everything back and did a jlmkr restart docker
and things were still broken.
Reboot fixed it.
Here’s what ChatGPT said about this:
In your setup, where you created a bridge (br0
) in TrueNAS SCALE so that VMs can communicate with the TrueNAS host, adding the Docker virtual bridge (vb-docker
) as a member of br0
may or may not be necessary depending on your networking goals. Let’s walk through some considerations.
1. What You’ve Done So Far:
br0
: A bridge interface that allows your VMs to communicate with each other and the TrueNAS host. It has the physical Ethernet interface (e.g.,enp3s0
) as a member.- VMs: Connected to
br0
, allowing them to access the LAN and potentially the TrueNAS host.
2. Adding vb-docker
to br0
:
If your goal is to let Docker containers talk to the TrueNAS host and VMs via br0
, adding vb-docker
to the bridge may be a reasonable approach. Here’s what you need to consider:
-
Docker Networking Default Behavior: By default, Docker uses its own bridge (
docker0
or in your case,vb-docker
) for container networking. This bridge is typically isolated from other networks, which means containers may not be able to communicate directly withbr0
, the VMs, or even the TrueNAS host (except through port forwarding or NAT). -
Combining
vb-docker
andbr0
:- If you add
vb-docker
as a member ofbr0
, Docker containers will be able to communicate directly with the TrueNAS host, VMs, and other devices on the same network segment (without needing port forwarding or NAT). - The downside is that Docker might not fully control the networking stack for the containers, which could lead to issues with Docker’s network isolation, port management, or conflicting IP assignments.
- If you add
3. Alternative: Use Docker’s Macvlan Network
Instead of adding vb-docker
to br0
, a more controlled approach might be to use Docker’s Macvlan driver. This allows you to assign Docker containers IP addresses on the same subnet as br0
, letting them communicate with the TrueNAS host and VMs without modifying vb-docker
.
Here’s how you can create a Macvlan network for Docker:
docker network create -d macvlan \
--subnet=192.168.1.0/24 \
--gateway=192.168.1.1 \
-o parent=br0 \
macvlan_net
parent=br0
: Specifies that Docker should attach containers to thebr0
bridge.subnet
andgateway
: Should match the network yourbr0
interface is on (adjust as needed for your network setup).
This will allow Docker containers to communicate with VMs, the TrueNAS host, and other devices on your LAN, while still maintaining Docker’s control over the network isolation for containers.
4. When to Add vb-docker
to br0
:
You might want to add vb-docker
to br0
if:
- You don’t need network isolation between Docker containers, VMs, and the TrueNAS host.
- You want all network devices to be part of the same bridge, allowing direct communication between containers, VMs, and the host without any Docker-specific networking complexities.
5. When to Use Docker’s Macvlan or Stick to vb-docker
:
- If you need isolation or want Docker to manage its own networking, use Docker’s Macvlan network or stick with the default
vb-docker
configuration. - If your priority is simplicity and direct connectivity between all systems (containers, VMs, and host), then adding
vb-docker
tobr0
might work, but be mindful of potential network conflicts.
Conclusion:
- If you want all devices (VMs, containers, and TrueNAS host) to communicate seamlessly, adding
vb-docker
tobr0
might be a simple solution, but it reduces Docker’s ability to manage its own networking. - For better network management and isolation, consider using Docker’s Macvlan network, which allows containers to have their own IP addresses on the same subnet as
br0
, without losing Docker’s networking features.
Let me know which approach you prefer or if you need further details!