Docker

docker run -p 9000:8000

Naranjito 2023. 4. 14. 15:26
  • The first port(9000) : the Docker host (you can use this port to access to your container) to access to the container from the outside.
  • the second port(8080) : is the port used by your application.

 

Example :  I want to run tomcat server in a docker container, the default port of tomcat is 8080 and I want to expose my docker on port 9000 so I have to write :

docker run -p 9000:8080 --name myTomcatContainer tomcat

So with this configuration I can access to Tomcat from outside using : http://host-ip:9000