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





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















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


Problem statement : -



I have a master machine and a worker machine on the same LAN. Both are connected by the 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 200.184.152.0/24 --gateway 200.184.152.254 --driver overlay my network

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




zoo1 : 200.184.152.2
zoo2: 200.184.152.3
zoo3: 200.184.152.4



After moving to the shell of the worker machine by using the command :



eval $(docker-machine env worker-1)



I run zookeeper’s first instancezoo1: 200.184.152.2. It successfully runs.
Then I try to run second Zookeeper instance zoo2: 200.184.152.3, but it fails to give 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": "200.184.152.2/24",
"IPv6Address": ""
},
"lb-my-network": {
"Name": "my-network-endpoint",
"EndpointID": "8f747b26e921ee1543631b758b7dfaf8c7e820c47a95849608dc3568f9957e79",
"MacAddress": "02:42:c8:b8:98:03",
"IPv4Address": "200.184.152.3/24",
"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 the 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.










share|improve this question

























  • may i know why do you want to bind zookeeper container with fixed IP address?

    – Siyu
    Nov 23 '18 at 10:50











  • @Siyu, Actually I don't specifically want to run zookeeper by binding an IP address. It works when I just don't bind address and connect them via there hostname like zoo1,zoo2,zoo3. But there is Kafka cluster running which connects to this zookeeper ensemble and every time one of the zoo services goes down and come back online it's IP address change and Kafka cluster doesn't connect. Binding IP address works. Moreover, there are other components in the system that cannot run via docker hostname technique, for example, Redis cluster, it does not work with hostname but only specific IP address.

    – sigmundsdottir
    Nov 23 '18 at 13:56











  • Don't know much in this area, but I suppose "lb-my-network" won't change afterward, maybe you can just avoid that ip?

    – Siyu
    Nov 23 '18 at 15:19











  • @Siyu, the ip taken by "lb-my-network" isn't constant. Suppose, after running zoo1 container, I see what IP is of "lb-my-network", then I run zoo2,zoo3 at different IP's. All fine, but when I take down these three zoo instances, and start them again, the "lb-my-network" will have a new different IP address and I would have to reconfigure my scripts/configurations files of the complete tech stack, and this can happen with other components in the system too, which means I will be spending more time in changing configurations than actually running the system. Thanks for your support and time.

    – sigmundsdottir
    Nov 23 '18 at 16:15


















0















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


Problem statement : -



I have a master machine and a worker machine on the same LAN. Both are connected by the 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 200.184.152.0/24 --gateway 200.184.152.254 --driver overlay my network

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




zoo1 : 200.184.152.2
zoo2: 200.184.152.3
zoo3: 200.184.152.4



After moving to the shell of the worker machine by using the command :



eval $(docker-machine env worker-1)



I run zookeeper’s first instancezoo1: 200.184.152.2. It successfully runs.
Then I try to run second Zookeeper instance zoo2: 200.184.152.3, but it fails to give 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": "200.184.152.2/24",
"IPv6Address": ""
},
"lb-my-network": {
"Name": "my-network-endpoint",
"EndpointID": "8f747b26e921ee1543631b758b7dfaf8c7e820c47a95849608dc3568f9957e79",
"MacAddress": "02:42:c8:b8:98:03",
"IPv4Address": "200.184.152.3/24",
"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 the 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.










share|improve this question

























  • may i know why do you want to bind zookeeper container with fixed IP address?

    – Siyu
    Nov 23 '18 at 10:50











  • @Siyu, Actually I don't specifically want to run zookeeper by binding an IP address. It works when I just don't bind address and connect them via there hostname like zoo1,zoo2,zoo3. But there is Kafka cluster running which connects to this zookeeper ensemble and every time one of the zoo services goes down and come back online it's IP address change and Kafka cluster doesn't connect. Binding IP address works. Moreover, there are other components in the system that cannot run via docker hostname technique, for example, Redis cluster, it does not work with hostname but only specific IP address.

    – sigmundsdottir
    Nov 23 '18 at 13:56











  • Don't know much in this area, but I suppose "lb-my-network" won't change afterward, maybe you can just avoid that ip?

    – Siyu
    Nov 23 '18 at 15:19











  • @Siyu, the ip taken by "lb-my-network" isn't constant. Suppose, after running zoo1 container, I see what IP is of "lb-my-network", then I run zoo2,zoo3 at different IP's. All fine, but when I take down these three zoo instances, and start them again, the "lb-my-network" will have a new different IP address and I would have to reconfigure my scripts/configurations files of the complete tech stack, and this can happen with other components in the system too, which means I will be spending more time in changing configurations than actually running the system. Thanks for your support and time.

    – sigmundsdottir
    Nov 23 '18 at 16:15














0












0








0








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


Problem statement : -



I have a master machine and a worker machine on the same LAN. Both are connected by the 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 200.184.152.0/24 --gateway 200.184.152.254 --driver overlay my network

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




zoo1 : 200.184.152.2
zoo2: 200.184.152.3
zoo3: 200.184.152.4



After moving to the shell of the worker machine by using the command :



eval $(docker-machine env worker-1)



I run zookeeper’s first instancezoo1: 200.184.152.2. It successfully runs.
Then I try to run second Zookeeper instance zoo2: 200.184.152.3, but it fails to give 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": "200.184.152.2/24",
"IPv6Address": ""
},
"lb-my-network": {
"Name": "my-network-endpoint",
"EndpointID": "8f747b26e921ee1543631b758b7dfaf8c7e820c47a95849608dc3568f9957e79",
"MacAddress": "02:42:c8:b8:98:03",
"IPv4Address": "200.184.152.3/24",
"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 the 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.










share|improve this question
















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


Problem statement : -



I have a master machine and a worker machine on the same LAN. Both are connected by the 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 200.184.152.0/24 --gateway 200.184.152.254 --driver overlay my network

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




zoo1 : 200.184.152.2
zoo2: 200.184.152.3
zoo3: 200.184.152.4



After moving to the shell of the worker machine by using the command :



eval $(docker-machine env worker-1)



I run zookeeper’s first instancezoo1: 200.184.152.2. It successfully runs.
Then I try to run second Zookeeper instance zoo2: 200.184.152.3, but it fails to give 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": "200.184.152.2/24",
"IPv6Address": ""
},
"lb-my-network": {
"Name": "my-network-endpoint",
"EndpointID": "8f747b26e921ee1543631b758b7dfaf8c7e820c47a95849608dc3568f9957e79",
"MacAddress": "02:42:c8:b8:98:03",
"IPv4Address": "200.184.152.3/24",
"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 the 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.







docker docker-swarm docker-machine






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 23 '18 at 6:13









the_ultimate_developer

1,049823




1,049823










asked Nov 23 '18 at 4:33









sigmundsdottirsigmundsdottir

11




11













  • may i know why do you want to bind zookeeper container with fixed IP address?

    – Siyu
    Nov 23 '18 at 10:50











  • @Siyu, Actually I don't specifically want to run zookeeper by binding an IP address. It works when I just don't bind address and connect them via there hostname like zoo1,zoo2,zoo3. But there is Kafka cluster running which connects to this zookeeper ensemble and every time one of the zoo services goes down and come back online it's IP address change and Kafka cluster doesn't connect. Binding IP address works. Moreover, there are other components in the system that cannot run via docker hostname technique, for example, Redis cluster, it does not work with hostname but only specific IP address.

    – sigmundsdottir
    Nov 23 '18 at 13:56











  • Don't know much in this area, but I suppose "lb-my-network" won't change afterward, maybe you can just avoid that ip?

    – Siyu
    Nov 23 '18 at 15:19











  • @Siyu, the ip taken by "lb-my-network" isn't constant. Suppose, after running zoo1 container, I see what IP is of "lb-my-network", then I run zoo2,zoo3 at different IP's. All fine, but when I take down these three zoo instances, and start them again, the "lb-my-network" will have a new different IP address and I would have to reconfigure my scripts/configurations files of the complete tech stack, and this can happen with other components in the system too, which means I will be spending more time in changing configurations than actually running the system. Thanks for your support and time.

    – sigmundsdottir
    Nov 23 '18 at 16:15



















  • may i know why do you want to bind zookeeper container with fixed IP address?

    – Siyu
    Nov 23 '18 at 10:50











  • @Siyu, Actually I don't specifically want to run zookeeper by binding an IP address. It works when I just don't bind address and connect them via there hostname like zoo1,zoo2,zoo3. But there is Kafka cluster running which connects to this zookeeper ensemble and every time one of the zoo services goes down and come back online it's IP address change and Kafka cluster doesn't connect. Binding IP address works. Moreover, there are other components in the system that cannot run via docker hostname technique, for example, Redis cluster, it does not work with hostname but only specific IP address.

    – sigmundsdottir
    Nov 23 '18 at 13:56











  • Don't know much in this area, but I suppose "lb-my-network" won't change afterward, maybe you can just avoid that ip?

    – Siyu
    Nov 23 '18 at 15:19











  • @Siyu, the ip taken by "lb-my-network" isn't constant. Suppose, after running zoo1 container, I see what IP is of "lb-my-network", then I run zoo2,zoo3 at different IP's. All fine, but when I take down these three zoo instances, and start them again, the "lb-my-network" will have a new different IP address and I would have to reconfigure my scripts/configurations files of the complete tech stack, and this can happen with other components in the system too, which means I will be spending more time in changing configurations than actually running the system. Thanks for your support and time.

    – sigmundsdottir
    Nov 23 '18 at 16:15

















may i know why do you want to bind zookeeper container with fixed IP address?

– Siyu
Nov 23 '18 at 10:50





may i know why do you want to bind zookeeper container with fixed IP address?

– Siyu
Nov 23 '18 at 10:50













@Siyu, Actually I don't specifically want to run zookeeper by binding an IP address. It works when I just don't bind address and connect them via there hostname like zoo1,zoo2,zoo3. But there is Kafka cluster running which connects to this zookeeper ensemble and every time one of the zoo services goes down and come back online it's IP address change and Kafka cluster doesn't connect. Binding IP address works. Moreover, there are other components in the system that cannot run via docker hostname technique, for example, Redis cluster, it does not work with hostname but only specific IP address.

– sigmundsdottir
Nov 23 '18 at 13:56





@Siyu, Actually I don't specifically want to run zookeeper by binding an IP address. It works when I just don't bind address and connect them via there hostname like zoo1,zoo2,zoo3. But there is Kafka cluster running which connects to this zookeeper ensemble and every time one of the zoo services goes down and come back online it's IP address change and Kafka cluster doesn't connect. Binding IP address works. Moreover, there are other components in the system that cannot run via docker hostname technique, for example, Redis cluster, it does not work with hostname but only specific IP address.

– sigmundsdottir
Nov 23 '18 at 13:56













Don't know much in this area, but I suppose "lb-my-network" won't change afterward, maybe you can just avoid that ip?

– Siyu
Nov 23 '18 at 15:19





Don't know much in this area, but I suppose "lb-my-network" won't change afterward, maybe you can just avoid that ip?

– Siyu
Nov 23 '18 at 15:19













@Siyu, the ip taken by "lb-my-network" isn't constant. Suppose, after running zoo1 container, I see what IP is of "lb-my-network", then I run zoo2,zoo3 at different IP's. All fine, but when I take down these three zoo instances, and start them again, the "lb-my-network" will have a new different IP address and I would have to reconfigure my scripts/configurations files of the complete tech stack, and this can happen with other components in the system too, which means I will be spending more time in changing configurations than actually running the system. Thanks for your support and time.

– sigmundsdottir
Nov 23 '18 at 16:15





@Siyu, the ip taken by "lb-my-network" isn't constant. Suppose, after running zoo1 container, I see what IP is of "lb-my-network", then I run zoo2,zoo3 at different IP's. All fine, but when I take down these three zoo instances, and start them again, the "lb-my-network" will have a new different IP address and I would have to reconfigure my scripts/configurations files of the complete tech stack, and this can happen with other components in the system too, which means I will be spending more time in changing configurations than actually running the system. Thanks for your support and time.

– sigmundsdottir
Nov 23 '18 at 16:15












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53440692%2fdocker-internals-using-ip-address-from-the-user-s-ip-address-pool%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53440692%2fdocker-internals-using-ip-address-from-the-user-s-ip-address-pool%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to change which sound is reproduced for terminal bell?

Can I use Tabulator js library in my java Spring + Thymeleaf project?

Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents