Using Windows and I have pulled the Jenkins image successfully via
docker pull jenkins
I am running a new container via following command and it seems to start the container fine. But when I try to access the Jenkins page on my browser, I just get following error message. I was expecting to see the Jenkins main log in page. Same issue when I tried other images like Redis, Couchbase and JBoss/Wildfly. What am I doing wrong? New to Docker and following tutorials which has described the following command to expose ports. Same for some answers given here + docs. Please advice. Thanks.
docker run -tid -p 127.0.0.1:8097:8097 --name jen1 --rm jenkins
In browser, just getting a normal ‘Problem Loading page Error’.
The site could be temporarily unavailable or too busy.
3
Answers
Take a look at Jenkins Dockerfile from here:
As you can see port 8080 is being exposed and not 8097.
Change your command to
docker run -tid -p 8097:8080 --name jen1 --rm jenkins
What your command does is connects your host port 8097 with jenkins image port 8097, but how do you know that the image exposes/uses port 8097 (spoiler: it doesn’t).
This image uses port 8080, so you want to port your local 8097 to port that one.
Change the command to this:
Just tested your command with this small fix, and it works locally for me.
First, it looks a little bit strange use
-tid
. Since you’re trying to run it detached, maybe, it’d be better just-d
, and use-ti
for example to access via shelldocker exec -ti jen1 bash
.Second, docker localhost is not the same than host localhost, so, I’d run the container directly without 127.0.0.1. If you want to use it, you may specify
--net=host
, what makes 127.0.0.1 is the same inside and outside docker.Third, try to access first through port 8080 for initial admin password.
Definitively, in summary:
Then,
http://172.17.0.2:8080/
Finally, unlock Jenkins setting admin password. You can have a look at starting logs:
docker logs jen1