Docker Community Forums

Share and learn in the Docker community.

Choosing a network for exposed ports


(Jkmathes) #1

Assuming a very simple example with two networks:

docker network create n1
docker network create n2
docker create --net n1 <options> --name test <image>
docker network connect n2 test

Once I run this container, and expose ports in the normal fashion - how can I select to which network the exposed port is mapped?

When I expose ports from within the container, it always picks the first network that was created, with no option to choose the second network.