Home > Blockchain >  Can't access my Jenkins instance (container via browser)
Can't access my Jenkins instance (container via browser)

Time:07-26

this is my docker run command:

docker run -u 0 --privileged --name jenkins -it -d -p 80:80 -p 5000:5000 \
> -v /var/run/docker.sock:/var/run/docker.sock \
> -v $(which docker):/usr/bin/docker \
> -v /home/jenkins_home:/var/jenkins_home \
> jenkins/jenkins:latest

this is my docker ps result:

CONTAINER ID   IMAGE                    COMMAND                  CREATED          STATUS          PORTS                                                                                               NAMES
404c53c6108a   jenkins/jenkins:latest   "/usr/bin/tini -- /u…"   43 minutes ago   Up 42 minutes   0.0.0.0:80->80/tcp, :::80->80/tcp, 8080/tcp, 0.0.0.0:5000->5000/tcp, :::5000->5000/tcp, 50000/tcp   jenkins

CodePudding user response:

The Jenkins documentation references ports 8080 and 50000.

I suspect (!?) that these are the ports you must use for the container image too.

If you want to use the host's (!) port 80, then you must --publish=80:8080 (since the container exposes 8080).

Or, you can use the same port on the host --port=8080:8080.

You can't change container ports but you can change the ports the containers' ports are mapped to on the host.

  • Related