Search code examples
network-programmingdockerports

Exposing Docker Container Ports


I understand that to expose ports in a docker container, you can use the -p flag (e.g. -p 1-100:1-100). But is there a nice way to expose a large percentage of possible ports from the container to the host machine? For instance if I am running a router of sorts in a container that lives in a VM, and I would like to expose all ports in the container from 32768 upwards to 65535, is there a nice way to do this? As it stands I've tried using the -p flag and it complains about memory allocation errors.


Solution

  • Nvm. I figured out my misunderstanding. -P is what I want, and I want to expose and not explicitly map ports.