CodexBloom - Programming Q&A Platform

Unexpected 'No such device' scenarios when Using Network Bridge on Ubuntu 22.04 with Docker

👀 Views: 163 đŸ’Ŧ Answers: 1 📅 Created: 2025-06-12
docker ubuntu networking bash

I've been struggling with this for a few days now and could really use some help. I'm trying to set up a network bridge on my Ubuntu 22.04 server to allow Docker containers to communicate on the same subnet as the host machine. I've followed several tutorials, but I'm working with a frustrating scenario. After creating the bridge interface with the command below, I get a 'No such device' behavior when I try to attach a container to the bridge: ```bash sudo ip link add name br0 type bridge sudo ip link set dev br0 up ``` However, when I run `ip addr show`, the bridge `br0` does appear in the list, but it seems that Docker containers need to connect to it. Here's my Docker daemon configuration: ```json { "bridge": "br0" } ``` I also made sure to restart the Docker service after modifying the configuration: ```bash sudo systemctl restart docker ``` However, when I attempt to run a container with: ```bash sudo docker run --network br0 -it --name test-container alpine sh ``` I receive the following behavior: `behavior: No such device: br0`. I've also tried checking the permissions for the bridge interface and have run `sudo iptables -L` to ensure there aren't any rules blocking the traffic. I've even verified that the necessary kernel modules are loaded with `lsmod | grep bridge`, and they appear to be. In case it helps, my Docker version is `20.10.7`, and I've ensured that the system is fully updated. What could be causing this scenario? Are there any additional steps or configurations needed to properly set up a bridge network for Docker on Ubuntu? For context: I'm using Bash on Windows. My development environment is macOS. Thanks for any help you can provide!