<p>I could have mentioned this in comment first but I need 50 reputation to comment and I just joined this yesterday,</p>

<p>So, may I know what you are trying to achieve? If I interpret correctly, you want to move your VMs to Docker and then make those docker interact with each other as well as with graphics which is running on host? So consider it this way, you have 4 IP addresses, how would you make the communicate if it is simple LAN? Similarly you do it here. Allow hosts from that IP to work here. 
You can customize docker0 bridge to have gateway and CIDRs of your choice by modifying daemon.json</p>

<p><a href="https://docs.docker.com/v17.09/engine/userguide/networking/default_network/custom-docker0/" rel="nofollow noreferrer">Customize the Docker0 bridge</a></p>

<p>You can create your user defined networks too.</p>

<p>May be this will help you too?
<a href="https://docs.docker.com/v17.09/engine/userguide/networking/" rel="nofollow noreferrer">Docker Networking User Guide</a></p>

<p>You can even write your own network plugin. </p>

CC BY-SA 4.0
2019-01-11T10:58:09.477Z
Yes @deosha, you interpreted it correctly, i'll check this... thanks
TPS
CC BY-SA 4.0
2019-01-11T06:23:10.043Z
2019-01-11T06:23:10.043Z
deosha
<p>Our application is a combination of 4 different applications. The graphics part is running on a host and other 3 applications are running on 3 different <strong>VMs</strong>. Which uses bridge networking.</p>

<pre><code>eg. Graphics app1 - 192.168.2.201 (Base Machine/HOST)
    Application 2 - 192.168.2.202 (VM1)
    Application 3 - 192.168.2.203 (VM2)
    Application 4 - 192.168.2.204 (VM3)
</code></pre>

<p>Which is running fine.  </p>

<p>But, to get advantage of containers, we want to shift our VM applications into docker container. But in docker, when we are using Bridge Networking, it doesn't take IPs in HOST network, obviously because, Bridge network ID is not same as host. And application fails to run.  </p>

<p>How can we achieve the Bridge Networking with same network ID (say 192.168.2.0)? We cannot use Host networking.</p>

<p>Note: our application specifically wants IP in 192.168.2.0 network, otherwise it fails.</p>

CC BY-SA 4.0
2019-01-10T19:11:42.450Z
https://stackoverflow.com/questions/41376365/how-to-create-docker-containers-with-the-same-internal-ip-address Something like this maybe?
Levi
CC BY-SA 4.0
2019-01-12T15:39:23.250Z
`wants IP in 192.168.2.0 network`? Is it hardcoded in the software? Would it be possible to change the code?
030
<docker><containers><networking>
container on same network with host
TPS
# container on same network with host

(Asked by: username_0 on 2019-01-10)

Our application is a combination of 4 different applications. The graphics part is running on a host and other 3 applications are running on 3 different VMs. Which uses bridge networking.
eg. Graphics app1 - 192.168.2.201 (Base Machine/HOST)
    Application 2 - 192.168.2.202 (VM1)
    Application 3 - 192.168.2.203 (VM2)
    Application 4 - 192.168.2.204 (VM3)

Which is running fine.  
But, to get advantage of containers, we want to shift our VM applications into docker container. But in docker, when we are using Bridge Networking, it doesn't take IPs in HOST network, obviously because, Bridge network ID is not same as host. And application fails to run.  
How can we achieve the Bridge Networking with same network ID (say 192.168.2.0)? We cannot use Host networking.
Note: our application specifically wants IP in 192.168.2.0 network, otherwise it fails.

**Tags:** docker, containers, networking

> **Comments:**
> **username_1**: https://stackoverflow.com/questions/41376365/how-to-create-docker-containers-with-the-same-internal-ip-address Something like this maybe?  
> **username_2**: `wants IP in 192.168.2.0 network`? Is it hardcoded in the software? Would it be possible to change the code?  

---

## 1 answers

### Answer by username_3 on 2019-01-11. Score: 1 | Accepted answer

I could have mentioned this in comment first but I need 50 reputation to comment and I just joined this yesterday,

So, may I know what you are trying to achieve? If I interpret correctly, you want to move your VMs to Docker and then make those docker interact with each other as well as with graphics which is running on host? So consider it this way, you have 4 IP addresses, how would you make the communicate if it is simple LAN? Similarly you do it here. Allow hosts from that IP to work here.
You can customize docker0 bridge to have gateway and CIDRs of your choice by modifying daemon.json

[Customize the Docker0 bridge](https://docs.docker.com/v17.09/engine/userguide/networking/default_network/custom-docker0/)

You can create your user defined networks too.

May be this will help you too?
[Docker Networking User Guide](https://docs.docker.com/v17.09/engine/userguide/networking/)

You can even write your own network plugin.

> **Comments:**
> **username_0**: Yes @username_3, you interpreted it correctly, i'll check this... thanks  

---

