Docker Community Forums

Share and learn in the Docker community.

Docker network with Real Static IP

hi guys

A new IP address is purchased for a dedicated server, and I provide IP details:


I Create new network with command :

docker network create --gateway "" --subnet "" test

Now run new Ubuntu container with set network and IP :

docker run -it -d --net test --ip --name ubu 7e0

Now I go inside container via docker exec and check my external IP via curl and ipapi:

root@0c3678705b85:/# curl ''

But back Main IP dedicated server.

How to fix this and set new purchased static IP?

I am afraid this is not how it works…

By default a network of type bridge is created. Thus, regardless whether you assign an iprange of a public ip, a lan or any other public privat ip range, it will always be in an isolated not routed network. The outgoing ip you see is high likely the docker hosts’s public ip.

You might want to check whether using a network of type macvlan might solve your problem. It will act as if the macvlan network is connected to the host interface like as if connected usign a switch. Though, be aware that a macvlan child interface is not able to communicate with it’s parent interface!

1 Like

Thank you, I think on driver Macvlan It’s okay