Steps To Expose More Than One Port With Docker
Step 1: First, pull the Docker image using the below command. I have here used the jaegartracing Docker image.
docker pull jaegertracing/all-in-one:1.6
Step 2 : Run the docker image using this command .
docker run -d --name jaeger \
-e COLLECTOR_ZIPKIN_HTTP_PORT=9411 \
-p 5775:5775/udp \
-p 6831:6831/udp \
-p 6832:6832/udp \
-p 5778:5778 \
-p 16686:16686 \
-p 14268:14268 \
-p 9411:9411 \
jaegertracing/all-in-one:1.6
Here i am using jaegartracing image , just like this you can use other docker images . The basic command structure to expose multiple ports is :
docker run -d -p <host-port-1>:<container-port-1> -p <host-port-2>:<container-port-2> your-docker-image
Step 3: Now access these ports , and you can see the different website content . For example, at port 16686 you will see :
And at port 5778 you will see :
How Can I Expose More Than 1 Port With Docker ?
Docker is an important tool that simplifies the deployment process by encapsulating applications within a container. To facilitate various types of communication in a Docker container, we need to expose more than one port. Here in this guide, I will first cover what Docker is and how it has become an essential tool among developers. Then I will guide you through the different steps and Docker commands to expose more than one port in the Docker container.