Docker Community Forums

Share and learn in the Docker community.

How to set Public ip in Docker Container?

Hi All

First of all i am very new with Docker Technology , we have set a Docker application in Proxmox vm , An also able to configure docker container with my requirement like apache , mysql , php.

But i need to create vhost for each container that why i need to Set public ip for each docker container.
Isp Given me many ip which is publicly accessible. So please any body help me out .

What i need to install or what is next step . pls help me

MY ISP Range :
I try to set :

Please help me , my email id

I too am a newbie at Docker, but as far as I know, each container communicates with the outside (which could be other machines on your LAN, or to the Internet, or even to the host machine the container is running on!) via ports. Like 8081 on your host, even if that host is a VM. I tried having each container have its own IP address, assignable via DHCP from the router/modem on my LAN. Not possible, or at least not easily done. Particularly with no documentation to guide you!
So, instead of using many ISP-assigned IP addresses, you only need one. And then you can route traffic to each container via the ports on the host running Docker.
Hope this helps. If someone else has a better solution, I’d like to hear about it.
Bob Koretsky

Thanks for the suggestion ,

But that excresise i have already done . and thats work , but i need to assign public ip . because for domain pointing i need public ip . secondly some of our client want directly access to their container . in this case all port will open , not need assign specific port number every time.

I try to make a architecture like Aws elastic ip solution.

If their any solution please help me out

I wouldn’t try to give each container its own public IP address… Instead you likely want to run some kind of front-end reverse proxy container (nginx, Apache, etc.) with a vhost for each container you want to be externally routeable which is on the same docker network as the routed containers, then forward requests to that IP’s 80/443 to the relevant vhost

I am also looking the same solution.