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.

1 Answer 1


You need create user define network

docker network create -d transparent --subnet= --gateway= TransparentNet3

Then you need run container with key --ip

docker run -it --name nano03 --network=TransparentNet3 --ip someimage:sometag
  • 1
    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
    Commented Sep 10, 2018 at 15:08
  • 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. Commented Sep 10, 2018 at 16:56
  • 1
    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
    Commented Sep 11, 2018 at 4:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.