Stranger B.
Stranger B.

Reputation: 9364

How to delete interface docker0

I would like to remove the interface docker0. It would be better to avoid creating the interface docker0 when starting the service and using directly the eth0.

Upvotes: 57

Views: 125327

Answers (5)

hareeshG
hareeshG

Reputation: 11

If you don't want to create docker0 interface at all when docker starts then edit daemon.json(which is configuration file for docker) file to add line "bridge": "none" line to that json.

Upvotes: 1

Mostafa Ghadimi
Mostafa Ghadimi

Reputation: 6736

I have trouble with connecting to VPN after installing docker. The solution would be the following:

You can see the ip route table by executing ip route command in linux. Then delete any domains start with 172.16.x.x.

For example:

> ip route                                                                                                                                                                                
default via 192.168.1.1 dev wlp2s0 proto dhcp metric 20600 
169.254.0.0/16 dev wlp2s0 scope link metric 1000 
172.16.14.0/24 dev vmnet8 proto kernel scope link src 172.16.14.1 
172.16.57.0/24 dev vmnet1 proto kernel scope link src 172.16.57.1 
192.168.1.0/24 dev wlp2s0 proto kernel scope link src 192.168.1.4 metric 600

Then delete them like the following:

sudo ip route del 172.16.14.0/24 dev vmnet8 proto kernel scope link src 172.16.14.1  
sudo ip route del 172.16.57.0/24 dev vmnet1 proto kernel scope link src 172.16.57.1 

Upvotes: 0

Ankit Bindal
Ankit Bindal

Reputation: 1529

To delete the interface, use:

ip link delete docker0

You may require sudo privilege.

Upvotes: 100

Adam Wądołkowski
Adam Wądołkowski

Reputation: 322

I support @gile's solution.

Be careful when removing interfaces. I do not recommend you to remove bridge docker0 (the default docker0 is as a bridge - in my case).

The documentation says:

Bridge networks are usually used when you are in standalone containers that need to communicate.

https://docs.docker.com/network/#network-drivers

If you want to remove this interface, you can use the following tools in addition to the above solutions (for removing / adding interfaces I suggest you use the tools provided with the docker):

nmcli connection delete docker0

docker network rm docker0

brctl delbr docker0

Upvotes: 8

gile
gile

Reputation: 5976

By default, the Docker server creates and configures the host system’s docker0 interface as an Ethernet bridge inside the Linux kernel that can pass packets back and forth between other physical or virtual network interfaces so that they behave as a single Ethernet network.

Look at Understand Docker container networks and Customize the docker0 bridge

When you install Docker, it creates three networks automatically. You can list these networks using the docker network ls command:

$ docker network ls

Historically, these three networks (bridge, none, host) are part of Docker’s implementation. When you run a container you can use the --network flag to specify which network you want to run a container on. These three networks are still available to you.

The bridge network represents the docker0 network present in all Docker installations. Unless you specify otherwise with the docker run --network= option, the Docker daemon connects containers to this network by default. You can see this bridge as part of a host’s network stack by using the ifconfig command on the host.

Upvotes: 8

Related Questions