Mega Menu

Tuesday, April 21, 2020

Docker Port Mapping Basic Scenario

Port mapping can be used to map a port on localhost with that of the port of docker container on which the application is running. Below RUN command can be used for that

             docker run -p 8001:8080 -p 50001:50000 jenkins
                                            where 8001 and 50001 are the localhost ports and 8080, 50000 are ports of docker image.


Running a Jenkins Container -

   docker run jenkins
        Once the download is complete, we should be able to access Jenkins through browser. To do this, you need to find the port of the jenkins image using 'ps' and ip using 'inspect'
   
          docker ps       
   

    docker inspect {containerId}
   
This can be simplified using the port mapping.
   
   
Detailed steps for using Jenkins Image     -     https://hub.docker.com/_/jenkins/

No comments:

Post a Comment