Docker Community Forums

Share and learn in the Docker community.

How can I pass the --bip argument (change bridge network ip)


(Comavn) #1

Expected behavior

Networks in the 172.17.0.0/16 range should be accessible from the docker xhyve vm and from docker containers, for instance by passing the --bip argument to the docker daemon in order to change the default range.

Actual behavior

The default range of the default docker bridge is 172.17.0.0/16, and cannot be changed in Docker for Mac Version 1.11.2-beta15 (build: 9168). Because of this, there’s no way to reach servers in this range, either for pulling images (our private docker registry lives there) or for accessing servers there from containers running on my macbook.

Information

This is basically the same problem as Customizing subnet of bridge network , however the solution there is to use pinata to fix the configuration. However, pinata is nowhere to be found anymore, and it’s options have not been moved to the gui.

Steps to reproduce the behavior

  1. Install Docker Beta for Mac Version 1.11.2-beta15 (build: 9168)
    2a. Try to pull an image from a docker registry in the 172.17.0.0/16 range:
    % docker pull dockerregistry.prod.on2it.net/example/foo:latest
    result:
    Pulling repository 172.17.1.120/example/foo
    Error while pulling image: Get http://172.17.1.120/v1/repositories/example/foo/images: dial tcp 172.17.1.120:80: getsockopt: no route to host

or

2b. Try to access a server in the 172.17.0.0/16 range from a container:
% docker run --rm busybox traceroute 172.17.1.120
result:
traceroute to 172.17.1.120 (172.17.1.120), 30 hops max, 46 byte packets
1 86e41be6f829 (172.17.0.2) 3009.175 ms !H 3012.591 ms !H 3004.078 ms !H
(!H is host unreachable)


(Brian Romanko) #2

According to this Github Issue you can specify bip by editing the daemon config.

There is no UI for this yet, but you can change it.

In ~/Library/Containers/com.docker.docker/Data/database/com.docker.driver.amd64-linux is a git database.
The daemon configuration is under etc/docker/daemon.json, which just uses the config from: https://docs.docker.com/engine/reference/commandline/dockerd/#/linux-configuration-file

You’d want to set bip to whatever subnet you like, but note that you need to use a real IP, not a .0 one… for instance… 192.168.0.1/24, not 192.168.0.0/24

You need to change the config and then do a git commit, docker should restart automatically at that point (if not, restart it) with the new configuration.