Issue with Docker Bridge Network Creation - Duplicate Gateway IP


To address this issue, let’s take a closer look at the command

sudo docker network create --driver bridge --subnet --gateway my_bridge

issues with creating a Docker bridge network, specifically encountering a problem with duplicate gateway IP addresses. in result overall network goes down

if I manually change the ip of brdige it works fine but when the system restated it again takes the same ip & down the overall network due to duplicate ip so please suggest solution

Are you trying to configure the subnet of a local network to this container network?

A docker bridge network is not supposed to share the ip range of an existing subnet in your local lan. It provides its own ip address managment (=dhcp).

If you want your containers to have ip addresses of your lan, you can take a look at macvlan or ipvlan (both not available on Docker Desktop).

I am able to assign IP addresses to containers that belong to my existing LAN subnet and these ips are accessible from the network also. After changing the bridge IP, there are no issues. However, once my system restarts, it takes the gateway of the subnet as an IP for the bridge, creating duplication of the gateway in the network.

Let me repeat myself: you are fighting with problems, because you use something in a way it is not supposed to be used.

Furthermore, I gave you a hint about what network type is supposed to be used in your scenario.

But hey, what do I know: you do you :slight_smile:

I aim to run multiple containers on a single system, each with a full operating system akin to VirtualBox or VMware. These services should be accessible from the internet. To achieve this, I created a Docker bridge named ‘my_bridge’ and assigned a subnet and gateway to it. However, the bridge automatically took the gateway as its IP, causing a duplicate gateway issue. To resolve this, I manually assigned an IP from the subnet to the bridge. Subsequently, I connected all the containers to this bridge and individually assigned IP addresses, netmasks, and DNS settings to each container. This setup worked well initially, but upon restarting the system, the bridge reverted to taking the gateway as its IP, resulting in a duplicate gateway in the network and subsequently affecting the entire network’s functionality.