I have problem with connecting two networks to container by differently port for each network.
enter image description here
I must create container C2 and network bridge1.
C2 must be accessible from default bridge by port 80 and bridge1 by port 8000.
I’ve tried run C2 with published 80:80
docker network create -d bridge --subnet 10.0.12.0/24 bridge1 docker run -itd --name C2 -p 80:80 nginx
and connect C2 to bridge1
docker network connect docker1 C2
but then i can’t add port mapping 8000:80 for bridge1.
Second idea was create two port mapping:
docker network create -d bridge --subnet 10.0.12.0/24 bridge1 docker run -itd --name C2 -p 80:80 -p 8000:80 nginx docker network connect docker1 C2
But now I can’t specify which port is for the default network and which is for bridge1.
Both are available on both networks.
I looked for in documentation but found nothing.
Source: Docker Questions