<p>You need create user define network</p>

<pre><code>docker network create -d transparent --subnet=10.1.1.0/24 --gateway=10.1.1.1 TransparentNet3
</code></pre>

<p>Then you need run container with key --ip</p>

<pre><code>docker run -it --name nano03 --network=TransparentNet3 --ip 10.1.1.1 someimage:sometag
</code></pre>

CC BY-SA 4.0
2018-09-10T15:08:12.887Z
Transparent driver only work when we are running docker in window mode(switch to window container option).As i have already mention above my application can't run in window docker mode.I have to run in linux mode(switch to linux container option).
chetan
CC BY-SA 4.0
2018-09-10T16:56:49.287Z
why you need static ip. user dns 
    he host has a changing IP address (or none if you have no network access). From 18.03 onwards our recommendation is to connect to the special DNS name host.docker.internal, which resolves to the internal IP address used by the host. This is for development purpose and will not work in a production environment outside of Docker for Windows.

The gateway is also reachable as gateway.docker.internal.
Meiram Chuzhenbayev
CC BY-SA 4.0
2018-09-11T04:45:54.073Z
Static ip is need of my application.My application has three way handshake and it's failing as it docker ip cannot be reached from outside world.
chetan
CC BY-SA 4.0
2018-09-09T14:08:13.793Z
2018-09-09T14:08:13.793Z
Meiram Chuzhenbayev
<p>I want to assign static ip to my docker container in docker for Window for linux container.
I have achieved same in linux container using macvlan but macvlan doesn't support for docker for Windows.
Does any one have work around how can i assign static ip to my linux container so it directly expose to outside world without port mapping.
I have also tried to use transperent driver in window container with LCOW enabled but as my application need privileged and bind mount to cgroup window container can not be used.
Note:I have specific scenario to use static ip as port mapping is not working for my application.</p>

<docker><containers><windows>
How to assign static ip in docker for Windows for linux container?
chetan
# How to assign static ip in docker for Windows for linux container?

(Asked by: username_0 on 2018-09-08)

I want to assign static ip to my docker container in docker for Window for linux container.
I have achieved same in linux container using macvlan but macvlan doesn't support for docker for Windows.
Does any one have work around how can i assign static ip to my linux container so it directly expose to outside world without port mapping.
I have also tried to use transperent driver in window container with LCOW enabled but as my application need privileged and bind mount to cgroup window container can not be used.
Note:I have specific scenario to use static ip as port mapping is not working for my application.

**Tags:** docker, containers, windows


---

## 1 answers

### Answer by username_1 on 2018-09-09. Score: 1

You need create user define network
docker network create -d transparent --subnet=10.1.1.0/24 --gateway=10.1.1.1 TransparentNet3

Then you need run container with key --ip
docker run -it --name nano03 --network=TransparentNet3 --ip 10.1.1.1 someimage:sometag

> **Comments:**
> **username_0**: Transparent driver only work when we are running docker in window mode(switch to window container option).As i have already mention above my application can't run in window docker mode.I have to run in linux mode(switch to linux container option).  
> **username_1**: why you need static ip. user dns      he host has a changing IP address (or none if you have no network access). From 18.03 onwards our recommendation is to connect to the special DNS name host.docker.internal, which resolves to the internal IP address used by the host. This is for development purpose and will not work in a production environment outside of Docker for Windows.  The gateway is also reachable as gateway.docker.internal.  
> **username_0**: Static ip is need of my application.My application has three way handshake and it's failing as it docker ip cannot be reached from outside world.  

---

