How to change the default IP address of docker bridge adapter

+1 vote

Hi Guys,

I am new in docker. Whenever I launched a container it gets ip from bridge adapter and the default gateway is 172.17.0.1/16. But I want to change the default gateway address. How can I do that?

May 11, 2020 in Docker by akhtar
• 38,260 points

edited May 30, 2020 by MD • 8,415 views

1 answer to this question.

0 votes

Hi@akhtar,

You can reconfigure the default bridge network by providing the bip option along with the desired subnet in the daemon.json (default location at /etc/docker/daemon.json ) file as follows.

$ vim /etc/docker/daemon.json
{
  "bip": "172.200.0.1/16"
}

Then restart the docker daemon as root.

$ systemctl restart docker

Hope this will help.

answered May 11, 2020 by MD
• 95,460 points
Hi MD,
I did try this and it worked beautifully. However, once I bring up the containers, there is something called 'br-XXXXXXXX' which still shows ip from the default subnet. Could you please throw some light on this?

Thanks-MTL

Related Questions In Docker

0 votes
1 answer

How to obtain the Docker container's IP address from the host?

This can be done by executing the ...READ MORE

answered Jul 17, 2018 in Docker by Sophie may
• 10,620 points
• 10,654 views
0 votes
1 answer

How to increase the size of images while creating docker file?

Docker image optimization usually is intended to ...READ MORE

answered Oct 19, 2020 in Docker by anonymous
• 1,710 views
0 votes
1 answer

How to get the hostname of the manager node in the Docker swarm?

Hi@akhtar, You can find the manager hostname using ...READ MORE

answered Dec 24, 2020 in Docker by MD
• 95,460 points
• 5,485 views
0 votes
1 answer

How to run a docker command from inside the container?

You must have come across the /var/run/docker.sock file, ...READ MORE

answered Jun 28, 2018 in Docker by Sophie may
• 10,620 points
• 5,419 views
+2 votes
1 answer
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
• 9,057 views
0 votes
1 answer

How to find a Docker container IP address from the command line?

Hi@akhtar, You can use the docker inspect command ...READ MORE

answered Sep 4, 2020 in Docker by MD
• 95,460 points
• 5,616 views
0 votes
1 answer

How to connect to the localhost of the machine from the Docker container?

Hi@akhtar, You can use --network="host" in your docker run command. It will ...READ MORE

answered Dec 23, 2020 in Docker by MD
• 95,460 points
• 12,991 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP