SoFunction
Updated on 2025-03-09

Solve docker network errors (network bridge not found)

question

Docker has no network model

root@sh-gpu102:~# docker run -it -d -v /mnt:/mnt -v /ssd:/ssd /more/lite:2.7.0.1542.4e07369
dece9b6df7a13285a53877dc016f518a7657abbe9c03c861a34ec1472b7789b3
docker: Error response from daemon: network bridge not found.
root@sh-gpu102:~# docker network ls
NETWORK ID          NAME                DRIVER              SCOPE
root@sh-gpu102:~#

Restart method

root@sh-gpu102:~# systemctl restart docker

Not working?

root@sh-gpu102:~# docker network ls
NETWORK ID          NAME                DRIVER              SCOPE
root@sh-gpu102:~#

Only customize the bridge

root@sh-gpu102:~# docker network create --driver bridge --subnet 172.200.0.0/16 --gateway 172.200.0.1 ai-bridge
9029d91739e65fde98bf737e615ec484410370c74ee7582ed6727c7dad4517dd
root@sh-gpu102:~# docker network ls
NETWORK ID          NAME                DRIVER              SCOPE
9029d91739e6        ai-bridge        bridge              local

Create a container

root@sh-gpu102:~# docker run -it -d -v /mnt:/mnt -v /ssd:/ssd --net ai-bridge /more/lite:2.7.0.1542.4e07369
b0ca771aa2cf1945e469c835b43beb0e3ca279867a20e9035fa218ec04ee65f8
# Check container statusroot@sh-gpu102:~# docker ps |grep b0ca771aa
b0ca771aa2cf        /more/lite:2.7.0.1542.4e07369   "/bin/bash"               About a minute ago   Up About a minute                              brave_galois
# Enter the container verification networkroot@sh-gpu102:~# docker exec -it b0ca771aa /bin/bash
root@b0ca771aa2cf:~/body_front# ping 
PING  (220.181.38.149) 56(84) bytes of data.
64 bytes from 220.181.38.149 (220.181.38.149): icmp_seq=1 ttl=47 time=2.19 ms
64 bytes from 220.181.38.149 (220.181.38.149): icmp_seq=2 ttl=47 time=2.07 ms
64 bytes from 220.181.38.149 (220.181.38.149): icmp_seq=3 ttl=47 time=2.05 ms
64 bytes from 220.181.38.149 (220.181.38.149): icmp_seq=4 ttl=47 time=2.17 ms
64 bytes from 220.181.38.149 (220.181.38.149): icmp_seq=5 ttl=47 time=2.04 ms
^C
---  ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4004ms
rtt min/avg/max/mdev = 2.040/2.108/2.194/0.080 ms
root@b0ca771aa2cf:~/body_front#

One disadvantage is

The network model must be specified

Although bridge is the default network model for docker

But the custom one obviously does not replace the default bridge of docker

root@sh-gpu102:~# docker run -it -d -v /mnt:/mnt -v /ssd:/ssd /more/lite:2.7.0.1542.4e07369
dd6d3102d1156253dcb6221087dd3799efaeff9b46873d19fb6b1eeda17b93e0
docker: Error response from daemon: network bridge not found.
root@sh-gpu102:~#

As for why there is no network model, the root cause of this problem has not been found, so I can only wait and check it later.

Summarize

The above is personal experience. I hope you can give you a reference and I hope you can support me more.