skip to Main Content

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


  1. Take a look at Jenkins Dockerfile from here:

    FROM openjdk:8-jdk
    
    RUN apt-get update && apt-get install -y git curl && rm -rf /var/lib/apt/lists/*
    
    ARG user=jenkins
    ARG group=jenkins
    ARG uid=1000
    ARG gid=1000
    ARG http_port=8080
    ARG agent_port=50000
    .....
    .....
    # for main web interface:
    EXPOSE ${http_port}
    
    # will be used by attached slave agents:
    EXPOSE ${agent_port}
    

    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

    Login or Signup to reply.
  2. 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:

    docker run -tid -p 127.0.0.1:8097:8080 --name jen1 --rm jenkins
    

    Just tested your command with this small fix, and it works locally for me.

    Login or Signup to reply.
  3. 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 shell docker 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:

    docker run -d -p 8097:8080 --name jen1 --rm jenkins
    

    Then,
    http://172.17.0.2:8080/

    Finally, unlock Jenkins setting admin password. You can have a look at starting logs: docker logs jen1

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search