Exchange default address used by Docker (172.17.0.1)

Asked

Viewed 1,362 times

3

I would like to exchange (or remove) the 172.17.0.1 address used by the Ocker networks, has how to do this?

I use Docker for php development and have a remote repository (git) configured via a VPN using the IP range 172.17.X. X.

Whenever my containers are up, the Docker network uses this IP range and I am unable to make any request to the remote repository.

Thank you.

NOTE: I use a Linux environment (Mint 19)


I was able to solve my problem by setting a subnet on the network used by my containers in the file Docker-Compose.yml. That way:

networks:
  frontend:
    driver: bridge
    ipam:
      config:
        - subnet: 172.18.0.0/16
  backend:
    driver: bridge
    ipam:
      config:
        - subnet: 172.19.0.0/16

1 answer

0


The default network settings (bridge ) of Docker can be changed by editing the file daemon.json, in the directory /etc/docker/. Follow an example of the file daemon.json:

 {
  "bip": "192.168.1.5/24",
  "fixed-cidr": "192.168.1.5/25",
  "fixed-cidr-v6": "2001:db8::/64",
  "mtu": 1500,
  "default-gateway": "10.20.1.1",
  "default-gateway-v6": "2001:db8:abcd::89",
  "dns": ["10.20.1.2","10.20.1.3"]
}

One option would be to configure a new network using the docker network create ...

In the documentation you see more information, about the drivers network available, how to configure a new network and how change the settings of bridge pattern.

  • I had already included in this file a configuration for the bridge network starting at 172.30.0.1 (I put only the bip option). Did I have to specify all options that are indicated in doc? Thank you

  • Your daemon.json is the same as the documentation?

  • No. There is a json with the bip option only.

  • I didn’t understand if the gateway and if dns should be set based on my real network or leave these values even standards. That’s why I left only the Bep option

  • In doc says that you edit only what will customize (Only specify the Settings you need to customize.), can leave your daemon only the bip same. Restarted the Docker after you made the changes?

  • Yes. I restarted yes

  • So.. I would recommend you set up a new one bridge and add to daemon.json({"bridge" : "minha_rede"}) , That’s the only way it’s supposed to work.

Show 2 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.