Docker Community Forums

Share and learn in the Docker community.

Can't ping / access docker host on 172.17.0.1 from inside a container

My docker host listens on 172.17.0.1.

I can curl it from the host machine, but when I curl the same ip/port from within the container I get timeout.

I can ping anything from withing the container but I can’t access the host.

What am I missing ?

Container is Jenkins image run by this command:

docker run -d --name jenkins -v jenkins_home:/var/jenkins_home -p 8080:8080 -p 50000:50000 jenkins/jenkins:2.222.3

Running curl on the host:

curl http://172.17.0.1:2375 {“message”:“page not found”}

Running curl from withing the docker will time out.

curl http://172.17.0.1:2375 curl: (7) Failed to connect to 172.17.0.1 port 2375: Connection timed out

Your’re exposing only port 8080 and 50000 … not 2375

the 2375 is being exposed by the HOST not by the container. I want to be able to call the docker api from the container - the daemon runs and listen on 172.17.0.1

Hmmm … maybe this will help