The -p (--publish) option of the docker container run command supports four configurations that you can use to publish your containerized service to the external world, as shown in the following list:
- <hostPort>:<containerPort>: This configuration was addressed in an earlier recipe.
- <containerPort>: In this configuration, we just specify the container port and let the Docker Engine select the Docker host port. The typical port range is from 32768 to 61000, which is defined in /proc/sys/net/ipv4/ip_local_port_range.
- <ip>:<hostPort>:<containerPort>: This configuration is very similar to <hostPort>:<containerPort>; however, here you are specifying a particular IP interface of the Docker host.
- <ip>::<containerPort>: This configuration ...