Docker Community Forums

Share and learn in the Docker community.

Forward specific port from docker network to host network

docker

#1

i use two networks for create two containers that use dynamic port

docker network create --subnet=172.18.0.0/16 net1
docker run --name  container1    --net=net1 -d image

and use another network

docker network create --subnet=172.19.0.0/16 net2
docker run --name  container2   --net=net2 -d image

i want to use only port 80 from container1 to host and port 8080 from container2 to host and use from internet(output)

note i cannot run both container in --net=host mode because of their port conflict and i must create two networks


(Fsejoseph) #2

What is the question?