8

Is there any way we can disable docker0 bridge on docker startup ?

Tried "bridge": "none" in daemon.json but its not working.

Also removed default docker bridge using "ip link delete docker0" but when we restart docker it came up automatically. So any permanent way to disable/delete default docker bridge on startup ? I see the same question here How to delete interface docker0 but I already tried that and whenever docker is restarted the docker0 bridge came back.

Jyothish
  • 1,031
  • 1
  • 9
  • 19
  • 1
    Possible duplicate of [How to delete interface docker0](https://stackoverflow.com/questions/40082608/how-to-delete-interface-docker0) – DevHugo Sep 03 '18 at 09:45
  • No. The solution mentioned there not working. – Jyothish Sep 03 '18 at 11:50
  • I think I found the answer. Inorder to disable the default bridge network add `"bridge": "none"` in daemon.json and restart docker service. The changes will taken effect immediately if there is no running containers there. In my case there is some containers already running and these changes not taken effect. After inspecting the log, could see that `info msg="There are old running containers, the network config will not take affect" `So I stopped the running container and restarted the docker service. After that bridge network is disabled. Hope this help someones. – Jyothish Sep 04 '18 at 05:40

2 Answers2

13

Create file /etc/docker/daemon.json

{
    "bridge": "none"
}

And restart docker: systemctl restart docker

meetnick
  • 1,196
  • 2
  • 12
  • 28
Anton
  • 131
  • 1
  • 2
5

I think I found the answer. Inorder to disable the default bridge network add "bridge": "none" in daemon.json and restart docker service. The changes will taken effect immediately if there are no running containers. In my case there were some containers already running, so changes not taken effect. After inspecting the log, could see that info msg="There are old running containers, the network config will not take affect" So I stopped the running container and restarted the docker service. After that bridge network is disabled. Hope this help someone.

Jyothish
  • 1,031
  • 1
  • 9
  • 19
  • Where is this documented? I could not find it – Mohammed Noureldin Oct 16 '21 at 20:04
  • It is documented as part of the [dockerd documentation](https://docs.docker.com/engine/reference/commandline/dockerd/#run-multiple-daemons), see the `--bridge` flag (which can be set via `daemon.json`, so same semantics apply. – falstaff Oct 24 '22 at 11:01