Docker Community Forums

Share and learn in the Docker community.

Can we assign VM ip address to docker container


I installed a docker containerized application on a RHEL VM.Below are the list of questions i have.

  1. Can i use the same public IP address IP to container?



Why would you want that?

When using the bridged network, you access the container using your host ip or host name and the port you mapped from the host to the container. A port mapping can be even bound to a specific host ip: -p {host ip}:{host port}:{container port}.

Otherwise you can use host interfaces with --network host, though ALL ports of the container will be bound to the host. If a single port clashes with an already used one, the container will not start.

If you public ip adress is the host ip, you already have what you want.