How to find the IP address to run the jenkins outside the host

Hi Experts,

kindly help me to understand the IP mapping, i was seeing your lecture (Demo: Advance Docker Run features) how can i find the IP address to run the jenkins outside the host. in the video IP was 192.168.1.14

looking forward to your response.

Regards,
Zia

@vijin.palazhi kindly help me to understand this.

@mzia87 If you want to access the jenkins inside the container itself, you can use the IP address assigned to the container in the 172.17.0.0/24 range. And this IP can be seen in the Networking section by issuing a docker inspect [name or ID of the container] command. You can otherwise access the jenkins inside the host by putting the [IP-Address of your docker host:the mapped host port] This means you need to map the jenkins container port to the host port using [-p] flag during the time you run the jenkins image to create your jenkins container. docker run -d --name my-jenkins -p [container port:host port] jenkins

I am running into same problem and unable to connect to Docker host.
I’ll explain my doubts may be you can help me here.

Docker Host:
I am running Docker on my local Mac, so as per me my machine is nothing but a docker host.
On my local machine I am unable to find docker host ip?

If you have find any solution, please do let me know as well.

try in browser http://127.0.0.1:8080

Hi mzia87,

Check the example below for 20. Demo to know what you have missed.

Also, the docker host IP is the IP of the machine itself and you can get it using the command ifconfig

There are two ways to access the application :

  1. Without port mapping, you can access your application using http://172.17.0.2:5000. But for this, you need to be able to access the IP 172.17.0.2. This IP is an IP assigned to the docker container by the docker host. So you must be inside your Docker host (which I believe is a Linux VM in your case). If your Linux VM doesn’t have a GUI, then you can try accessing your application using curl like this: curl http://172.17.0.2:8080/hello

  2. With Port Mapping - To access your application outside the Docker host, you need to map the port on the docker container (172.17.0.2:5000) to a port on the Docker host (192.168.10.100:5000). Because, from outside of your docker host, like your laptop, you can only ping the Docker host and not the docker container directly.

This is explained in detail in Demo - Docker run here