Docker: I do not have access to localhost when i run jenkins

Created on 22 Mar 2018  Â·  15Comments  Â·  Source: jenkinsci/docker

Docker commands that you execute

docker pull jenkins
docker run --name testJenkins -p 9090:9090 -p 50000:50000 jenkins

Actual result

it works, jenkins is fully up and running.

But in my browser
http://localhost:9090/
http://127.17.0.1:9090/
nothing works

http://localhost:50000/ , this is the result :
localhost

Expected outcome

I do not understand, Jenkins should appear in my browser.

Output of docker version

Docker version 17.12.0-ce, build c97c6d6

Have a good day !

Most helpful comment

Every Localhost having some IP address, So If you use docker in windows by Docker ToolBox at the Don't Check with Localhost:8080 in your browser why because that is not the actual host.Your Localhost running in Vmware so you can check your IP address by using this Command (docker-machine ip default)

For Example :
I got 192.168.99.100 - using this IP to run the Jenkins like 192.168.99.100:8080
Really It works...

All 15 comments

The port is 8080

the port 8080 is already used si i change to 9090

Unless you modified Jenkins internally, then you need to map your 9090 to jenkin's 8080:

docker run -p 9090:8080 ...

I've ran
docker run \ -u root \ --rm \ -d \ -p 8090:8080 \ -p 50000:50000 \ -v jenkins-data:/var/jenkins_home \ -v /var/run/docker.sock:/var/run/docker.sock \ jenkinsci/blueocean

But I'm still having the same problem

@LuanaFn what problem? What is the error message? If the port 8090, or 50000 are already taken on your machine, then you need to change them.

I'm getting a ERR_CONNECTION_TIMED_OUT time out error.

Port 50000 wasn't available so I removed the p 50000:50000 part and the process started fine on port 8090.

I'm still not able to connect from the browser..

Every Localhost having some IP address, So If you use docker in windows by Docker ToolBox at the Don't Check with Localhost:8080 in your browser why because that is not the actual host.Your Localhost running in Vmware so you can check your IP address by using this Command (docker-machine ip default)

For Example :
I got 192.168.99.100 - using this IP to run the Jenkins like 192.168.99.100:8080
Really It works...

Thanks to @vengatesanns
I run the command
i.e
C:\Users\ {your_PC_name}>docker-machine ip
192.168.99.100

your Docker Jenkins localhost ----> 192.168.99.100
set on my browser 192.168.99.100:9090 and the Jenkins is displayed.

@vengatesanns thanks man, it worked for me too!

Thanks @vengatesanns

It works. Basic Knowledge !!

@vengatesanns I had the same issue and got it solved. Thanks a lot :)

Thanks man :) @vengatesanns

Worked like charm, thanks @vengatesanns

I run below command, Jenkins container is not getting up.

$ sudo docker container run --name jenkins-blueocean --rm --detach --network jenkins --env DOCKER_HOST=tcp://docker:2376 --env DOCKER_CERT_PATH=/certs/client --env DOCKER_TLS_VERIFY=1 --volume jenkins-data:/var/jenkins_home --volume jenkins-docker-certs:/certs/client:ro --publish 8080:8080 --publish 50000:50000 jenkinsci/blueocean

$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
fa994b502def docker:dind "dockerd-entrypoint.…" 2 minutes ago Up 2 minutes 2375/tcp, 0.0.0.0:2376->2376/tcp jenkins-docker

Expected: jenkins-blueocean container should start.

Reference :
https://www.jenkins.io/doc/book/installing/#setup-wizard

Got a workaround:

$ sudo docker container run --name jenkins-blueocean
--volume jenkins-data:/var/jenkins_home --publish 8080:8080 --publish 50000:50000 jenkinsci/blueocean

For those who are having a permission issue like this:
Use the --privileged tag with the docker run command
OR
touch: cannot touch '/var/jenkins_home/copy_reference_file.log': Permission denied
Can not write to /var/jenkins_home/copy_reference_file.log. Wrong volume permissions?

sudo chown 1000:1000 /path/to/your/folder (jenkins-data)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

esterkin picture esterkin  Â·  5Comments

manoj150283 picture manoj150283  Â·  3Comments

edumco picture edumco  Â·  6Comments

simonCor picture simonCor  Â·  3Comments

szimmer1 picture szimmer1  Â·  5Comments