Docker Community Forums

Share and learn in the Docker community.

Run Docker/jenkins behind a proxy

For the past few days I’ve been scratching my head trying to get the Jenkins docker image to work

The issue appears to be a proxy issue.

OS: Ubuntu 16.04 LTS
Running behind work proxy
Docker version: Docker version 19.03.5, build 633a0ea838
Jenkins: https://hub.docker.com/_/jenkins/

When I run the following command, I can’t access jenkins on localhost:7000

docker run --name myjenkins -p 7000:8000 -p 50000:50000 -v /var/jenkins_home jenkins

However I can with the following command

docker run --name myjenkins -p 7000:8080 -p 50000:50000 --env HTTP_PROXY=“http:// localhost:8080” --env HTTPS_PROXY=“https:// localhost:8080” -v /var/jenkins_home jenkins

The issue is, with the second command, I can access the jenkins but I can’t install plugins and it asks me to configure the proxy
Setting the proxy in the UI didn’t work

My understanding is that Jenkins look for port 8080 by default and because in the command above I’m using port 7000, this is preventing Jenkins from connecting to the internet (correct me if I’m wrong)

So what I did was download the Dockerfile for Jenkins and changed the port from 8080 to 7000
Dockerfile

I am now attempting to build the image with the following command

docker build --tag jenkins:1.0 .

I get the following error

curl: (7) Failed to connect to github. com port 443: Connection timed out
The command ‘/bin/sh -c curl -fsSL https:// github. com/krallin/tini/releases/download/v${TINI_VERSION}/tini-static-amd64 -o /bin/tini && chmod +x /bin/tini && echo “$TINI_SHA /bin/tini” | sha256sum -c -’ returned a non-zero code: 7

I suspect, this is a proxy issue and I did put proxy arguments in the Dockerfile but not sure if this is what I need to do or whether I’m doing it correctly

Any idea what could be the solution?

Thank you

anyone can help me with this?