Docker Community Forums

Share and learn in the Docker community.

Docker internals using IP address from the user's IP address pool

(Sigmundsdottir) #1

Docker version 18.09.0, build 4d60db4
OS VERSION : Centos 7

Problem statement : -

I have master machine and a worker machine on same LAN. Both are connected by docker-machine utility. The worker machine is expected to run 3 zookeeper standalone containers. I have created a docker overlay network, on my master machine, using -

docker network create --attachable --subnet --gateway --driver overlay my-network

I want to bind zookeeper container with fixed IP address as follows : -

zoo1 :

After moving to shell of worker machine by using command :

eval $(docker-machine env worker-1)

I run zookeeper’s first instance zoo1 : . It successfully runs.
Then I try to run second Zookeeper instance zoo2: , but it fails giving a network error.

Then I inspect the network using docker network inspect my-network on worker machine and in the containers section it shows the results : -

"Containers": {
            "1a2471c777c907dc05bb0f23e819919354669de699f862e4fdc093293d145b31": {
                "Name": "zoo1",
                "EndpointID": "8bb5eebd1cacf36dc7cdad7fc3d72c45047c66b455c568cc9e8911d2121fd8d6",
                "MacAddress": "02:42:c8:b8:98:02",
                "IPv4Address": "",
                "IPv6Address": ""
            "lb-my-network": {
                "Name": "my-network-endpoint",
                "EndpointID": "8f747b26e921ee1543631b758b7dfaf8c7e820c47a95849608dc3568f9957e79",
                "MacAddress": "02:42:c8:b8:98:03",
                "IPv4Address": "",
                "IPv6Address": ""

This lb-my-network is using IP address required by my components, because of this the entire automatic deployment fails. The worst is, the IP address of lb-my-network changes it keeps clashing with IP address of other containers.

Is this expected? If yes, then how can I deploy a number of containers using automation when docker is using IP addresses randomly from the pool reserved by user’s logic.

In the documentation, it is stated that the docker needs three address for it’s working, a network address, a broadcast address and a gateway address, so 253 addresses can be used by user in /24 subnet. But here the lb-my-network is using IP address from the pool being expected to be used by user’s containers.

Help will be appreciated.

(ShaneP) #2

Getting these similar issues and errors, seems like a common error? Help is appreciated,