I have two laptops both with xubuntu, one has version 20.04 and the other has version 22.04.
20.04: when I create a dockerfile and add commands to download packages, they download without problem “sudo apt-get update”.
22.04: when I create a dockerfile and add commands to download packages, it is impossible to download the packages using “sudo apt-get update”, also none of the containers created in docker using xubuntu 22.04, none of the containers have internet connection.
I have identified that docker in version 20.04 creates by default the bridge network but in version 22.04 it does not create it.
does anyone know how can i add the default bridge network that docker creates?
I was recreating a network similar to how it looks in the inspection of the bridge network but I can’t get it right.
note xubuntu 22.04 docker does not create the bridge network but in 20.04 it does.
The suggestion of @ajeetraina is to create a user defined network. Compared to the default bridge network, they provide dns-based service discovery, and allows container to container communication using container names.
In order to use a user default network during builds, you need to add the --network my_bridge_network argument to docker built as well.
Thus said, I am curious about why the default bridge is not available.
Please share the outputs of these commands:
eaaldark@eaaldark-Aspire-ES1-411:~$ ip address show docker0
6: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
link/ether 02:42:f7:7d:5d:e9 brd ff:ff:ff:ff:ff:ff
inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
valid_lft forever preferred_lft forever
eaaldark@eaaldark-Aspire-ES1-411:~$ docker network inspect default
Error: No such network: default
I have never seen on any Ubuntu version that the docker0 interface and the default bridge network were not created. If either one of them doesn’t exist, a restart of the docker service (or a reboot) should create them. Strange that this is not happening for you.
My bad, this should have been docker network inspect bridge
I researched it a little and I encountered these:
caused by possible side effects from existing configuration in /etc/docker/daemon.json.
caused by a network range collision between the local lan and docker’s docker0 range 172.17.0.0/16.
suggestion to remove the docker network configuration after(!) stopping the docker service: rm -rf /var/lib/docker/network (warning: as a result all container networks will be gone!)
Hi, I also tried “docker network inspect bridge” and it returned the same result, but there is a detail, I uninstalled docker and reinstalled it through snap packages and the network bridge was created, but after installing docker through snap I try to create a container and there is still no internet connection.
I will try what you say, if not, I will have to try something I was also reading about resolv.conf on my laptop, for me this is new and I am a bit disoriented.
I’ve tried adding more addresses to the container in the resolv.conf file According to what I’ve read, but it still doesn’t work.
The snap package is not a vanilla distribution, it is modified to align with the philosophy of snap. It’s maintained and supported by Canonical. We don’t support it here. Many people managed to get a double installation: one from either a distro package or from docker’s repos + the snap package.
Thanks, I installed the package you provided from the link and it did not create the bridged network, but as you mentioned about deleting the docker network folder, I first shut down the docker service then deleted the folder and restarted the service, now in the terminal the bridged network shows data when inspecting it.