Docker - Run Containers On The Same Host and Port
It used to take quite a bit of effort to run two containers that want to use the same public port on the same host. However, now it's quite simple, as long as your host has multiple IP addresses.
We will run each container on a different IP, but with the same port. All this takes is adding the IP to the port specification as shown in the example below:
# container 1 docker run -p 10.1.0.45:80:80 -i -t ubuntu /bin/bash # container 2 docker run -p 10.1.0.46:80:80 -i -t ubuntu /bin/bash
First published: 16th August 2018