Multi host docker-compose with static internal IP for database
I am fighting with this over 3 weeks.
I've tried numerous of tutorials but none of them worked for me.
Basically I have > 10 servers that are running Ubuntu + docker.
Some of them are accessible via internal IP, some via public IP.
I have connected all locations using VPN.
They all can reach each other via 10.0.0.0/8
Now I've tried to create MySQL database on each of a servers (please do not ask why, as this is a part of requirements and won't change).
Some of those will be Masters, some Slaves.
Server A can host 4 Master DB and 3 Slave (all are interconnecting).
Basically I want to create a MySQL servers with static internal IP (exposing ports via virtual IP is already done, but static internal IP is part of requirements, won't change no matter what).
Unfortunately I've tried to create virtual interface
i.e. on each server (each server would be having only 1 ip with exposed port)
10.0.4.1
10.0.4.2
Then I've created a network sqlnet
docker network create --subnet=10.0.4.0/16 sqlnet
Unfortunately for some reason the server with internal IP is simply disconnects from network after that (I can use 10.0.5.0 or something similar), I have to use ILO to remove the network.
To be honest it seems like I have to be doing something wrong. Most of tutorials is useless as either requires additional knowledge (my only knowledge is to use dotnet build and to deploy it on a linux, due to cost of MS SQL we have to check if MySQL is reliable option).
Basically I want to create docker-compose (was trying to use stack, but getting a lot of different issues due to networking or interfaces being out of a scope, etc. etc.) that will deploy MySQL and expose it for a replication to other servers within the same VPN network.
Anyone knows how to do it ???? For some that internal IP is a hell on Earth (using -p IP:port works fine for other web apps/web api's, but those don't need static internal ip).
mysql docker
add a comment |
I am fighting with this over 3 weeks.
I've tried numerous of tutorials but none of them worked for me.
Basically I have > 10 servers that are running Ubuntu + docker.
Some of them are accessible via internal IP, some via public IP.
I have connected all locations using VPN.
They all can reach each other via 10.0.0.0/8
Now I've tried to create MySQL database on each of a servers (please do not ask why, as this is a part of requirements and won't change).
Some of those will be Masters, some Slaves.
Server A can host 4 Master DB and 3 Slave (all are interconnecting).
Basically I want to create a MySQL servers with static internal IP (exposing ports via virtual IP is already done, but static internal IP is part of requirements, won't change no matter what).
Unfortunately I've tried to create virtual interface
i.e. on each server (each server would be having only 1 ip with exposed port)
10.0.4.1
10.0.4.2
Then I've created a network sqlnet
docker network create --subnet=10.0.4.0/16 sqlnet
Unfortunately for some reason the server with internal IP is simply disconnects from network after that (I can use 10.0.5.0 or something similar), I have to use ILO to remove the network.
To be honest it seems like I have to be doing something wrong. Most of tutorials is useless as either requires additional knowledge (my only knowledge is to use dotnet build and to deploy it on a linux, due to cost of MS SQL we have to check if MySQL is reliable option).
Basically I want to create docker-compose (was trying to use stack, but getting a lot of different issues due to networking or interfaces being out of a scope, etc. etc.) that will deploy MySQL and expose it for a replication to other servers within the same VPN network.
Anyone knows how to do it ???? For some that internal IP is a hell on Earth (using -p IP:port works fine for other web apps/web api's, but those don't need static internal ip).
mysql docker
Would you consider using docker-compose? It's very easy to set static ips in the yaml file.
– George Appleton
Nov 20 '18 at 23:04
add a comment |
I am fighting with this over 3 weeks.
I've tried numerous of tutorials but none of them worked for me.
Basically I have > 10 servers that are running Ubuntu + docker.
Some of them are accessible via internal IP, some via public IP.
I have connected all locations using VPN.
They all can reach each other via 10.0.0.0/8
Now I've tried to create MySQL database on each of a servers (please do not ask why, as this is a part of requirements and won't change).
Some of those will be Masters, some Slaves.
Server A can host 4 Master DB and 3 Slave (all are interconnecting).
Basically I want to create a MySQL servers with static internal IP (exposing ports via virtual IP is already done, but static internal IP is part of requirements, won't change no matter what).
Unfortunately I've tried to create virtual interface
i.e. on each server (each server would be having only 1 ip with exposed port)
10.0.4.1
10.0.4.2
Then I've created a network sqlnet
docker network create --subnet=10.0.4.0/16 sqlnet
Unfortunately for some reason the server with internal IP is simply disconnects from network after that (I can use 10.0.5.0 or something similar), I have to use ILO to remove the network.
To be honest it seems like I have to be doing something wrong. Most of tutorials is useless as either requires additional knowledge (my only knowledge is to use dotnet build and to deploy it on a linux, due to cost of MS SQL we have to check if MySQL is reliable option).
Basically I want to create docker-compose (was trying to use stack, but getting a lot of different issues due to networking or interfaces being out of a scope, etc. etc.) that will deploy MySQL and expose it for a replication to other servers within the same VPN network.
Anyone knows how to do it ???? For some that internal IP is a hell on Earth (using -p IP:port works fine for other web apps/web api's, but those don't need static internal ip).
mysql docker
I am fighting with this over 3 weeks.
I've tried numerous of tutorials but none of them worked for me.
Basically I have > 10 servers that are running Ubuntu + docker.
Some of them are accessible via internal IP, some via public IP.
I have connected all locations using VPN.
They all can reach each other via 10.0.0.0/8
Now I've tried to create MySQL database on each of a servers (please do not ask why, as this is a part of requirements and won't change).
Some of those will be Masters, some Slaves.
Server A can host 4 Master DB and 3 Slave (all are interconnecting).
Basically I want to create a MySQL servers with static internal IP (exposing ports via virtual IP is already done, but static internal IP is part of requirements, won't change no matter what).
Unfortunately I've tried to create virtual interface
i.e. on each server (each server would be having only 1 ip with exposed port)
10.0.4.1
10.0.4.2
Then I've created a network sqlnet
docker network create --subnet=10.0.4.0/16 sqlnet
Unfortunately for some reason the server with internal IP is simply disconnects from network after that (I can use 10.0.5.0 or something similar), I have to use ILO to remove the network.
To be honest it seems like I have to be doing something wrong. Most of tutorials is useless as either requires additional knowledge (my only knowledge is to use dotnet build and to deploy it on a linux, due to cost of MS SQL we have to check if MySQL is reliable option).
Basically I want to create docker-compose (was trying to use stack, but getting a lot of different issues due to networking or interfaces being out of a scope, etc. etc.) that will deploy MySQL and expose it for a replication to other servers within the same VPN network.
Anyone knows how to do it ???? For some that internal IP is a hell on Earth (using -p IP:port works fine for other web apps/web api's, but those don't need static internal ip).
mysql docker
mysql docker
asked Nov 20 '18 at 21:45
MikeMike
64
64
Would you consider using docker-compose? It's very easy to set static ips in the yaml file.
– George Appleton
Nov 20 '18 at 23:04
add a comment |
Would you consider using docker-compose? It's very easy to set static ips in the yaml file.
– George Appleton
Nov 20 '18 at 23:04
Would you consider using docker-compose? It's very easy to set static ips in the yaml file.
– George Appleton
Nov 20 '18 at 23:04
Would you consider using docker-compose? It's very easy to set static ips in the yaml file.
– George Appleton
Nov 20 '18 at 23:04
add a comment |
1 Answer
1
active
oldest
votes
So the issue was solved by creating new interface on Docker host
i.e.
10.0.4.1,
Then in Docker-compose
ports:
- '10.0.4.1:4000:3306'
And by using this the interface 10.0.4.1 is accessible through out whole subnet 10.0.0.0/8 and all devices can see the docker container as it would be separate server.
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53402050%2fmulti-host-docker-compose-with-static-internal-ip-for-database%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
So the issue was solved by creating new interface on Docker host
i.e.
10.0.4.1,
Then in Docker-compose
ports:
- '10.0.4.1:4000:3306'
And by using this the interface 10.0.4.1 is accessible through out whole subnet 10.0.0.0/8 and all devices can see the docker container as it would be separate server.
add a comment |
So the issue was solved by creating new interface on Docker host
i.e.
10.0.4.1,
Then in Docker-compose
ports:
- '10.0.4.1:4000:3306'
And by using this the interface 10.0.4.1 is accessible through out whole subnet 10.0.0.0/8 and all devices can see the docker container as it would be separate server.
add a comment |
So the issue was solved by creating new interface on Docker host
i.e.
10.0.4.1,
Then in Docker-compose
ports:
- '10.0.4.1:4000:3306'
And by using this the interface 10.0.4.1 is accessible through out whole subnet 10.0.0.0/8 and all devices can see the docker container as it would be separate server.
So the issue was solved by creating new interface on Docker host
i.e.
10.0.4.1,
Then in Docker-compose
ports:
- '10.0.4.1:4000:3306'
And by using this the interface 10.0.4.1 is accessible through out whole subnet 10.0.0.0/8 and all devices can see the docker container as it would be separate server.
answered Nov 24 '18 at 13:37
MikeMike
64
64
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53402050%2fmulti-host-docker-compose-with-static-internal-ip-for-database%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
Would you consider using docker-compose? It's very easy to set static ips in the yaml file.
– George Appleton
Nov 20 '18 at 23:04