Docker Community Forums

Share and learn in the Docker community.

Set a container with a static IP from the local network

Is it possible to set a container with an static IP different from the host?

For example:
host’s IP:

Could I set a cointainer inside that host with an IP like:

And an external service get recognize both IPs when an HTTP request is made from them?

Yes and no: not by only using containers.
Though, why not add another virtual interface to your host interface and assign it the ip you want? Publised ports will always listen on all interfaces…

The other alternative is to use macvlan, which allows to hook a macvlan client interface in your lan. Though you container will only bound to this ip.