I am running the jenkins docker image. When starting, it complains that it is not possible to access the internet.
This is how I run it:
docker pull jenkins
mkdir jenkins-shared-volume
docker run -d -p 49001:8080 -p 50000:50000 -v jenkins-shared-volume:/var/jenkins_home -t --name jenkins jenkins
The jenkins instance is then running on http://localhost:49001. But it has connectivity issues:
Offline This Jenkins instance appears to be offline.
For information about installing Jenkins without an internet connection, see the Offline Jenkins Installation Documentation.
You may choose to continue by configuring a proxy or skipping plugin installation.
I have no proxy in my system (home laptop). I guess this is probably an obscure docker problem but:
Am I doing something wrong?
Just to make sure that indeed the docker container has direct access to the internet:
docker exec -it jenkins /bin/bash
jenkins@4ef4944a7cb7:/$ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: icmp_seq=0 ttl=44 time=29.859 ms
Running the container connected to the host
network solves the problem and lets jenkins access the internet:
docker run -d --net host -v jenkins-shared-volume:/var/jenkins_home -t --name jenkins jenkins
But I can not map ports: jenkins is directly reachable on http://localhost:8080, which can be a source of conflicts whenever other services are using the 8080 port.
Compose Configuration (Linux or macOS) Add a group docker if it does not exist, and add jenkins user to the docker group, e.g. groupadd docker && usermode -aG docker 'jenkins' . Adjust permissions on the docker. sock file so that jenkins user can access it, e.g. chmod 777 /var/run/docker.
Docker's fundamental platform and container design means that a single Docker image (for any given application like Jenkins) can be run on any supported operating system (macOS, Linux and Windows) or cloud service (AWS and Azure) which is also running Docker.
Go to Manage Jenkins -> Plugins -> Available and type “docker” into the field. Select “Docker plugin” and install it. Jenkins refers to the Docker plugin as a “cloud.” Click Manage Jenkins once again, and now click the Manage Clouds and Nodes button in the middle. Now click Configure Clouds on the left.
To see Jenkins, simply bring up a web browser and go to URL http :// myServer :8080 where myServer is the name of the system running Jenkins.
Strangely I ran into the same issue last night using the official Jenkins image:
docker run -p 8080:8080 --rm jenkins/jenkins
Though I have not figured out why yet or how to permanently fix it, I did find a work around.
Launch the image with the older un-supported image jenkins... do the initial setup.. then shut it down, swap the image and startup the official.
For reference here is my docker-compose.yml:
version: "2"
services:
app:
image: jenkins #after booting and initial setup swap to jenkins/jenkins
ports:
- "50000:50000"
- "8080:8080"
volumes:
- home:/var/jenkins_home
volumes:
home:
When you run 'ping 8.8.8.8', you are testing internet connection but not DNS resolution.
Try 'ping www.google.com', I think you are having a DNS issue, thats why Jenkins can't reach the plugins packages.
Edit /etc/docker/daemon.json and set your local DNS servers to avoid Docker using default Google Public DNS. Docker Docs - Daemon configuration file .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With