79748889

Date: 2025-08-28 09:36:38
Score: 2
Natty:
Report link

David Maze pointed me to this post about the same problem. The second answer:

In your Jenkins interface go to "Manage Jenkins/Global Tool Configuration"

Then scroll down to Docker Installations and click "Add Docker". Give it a name like "myDocker"

Make sure to check the box which says "Install automatically". Click "Add Installer" and select "Download from docker.com". Leave "latest" in the Docker version. Make sure you click Save.

did not work for me. I have to add that I'm new to Jenkins so I might have just failed to figure out the correct Jenkinsfile.

so I followed the first comment and made a custom Dockerfile. Although I followed this Jenkins Community post to create this Dockerfile:

Dockerfile.jenkins:

# https://github.com/jenkinsci/docker/blob/master/README.md
FROM jenkins/jenkins:lts-jdk17

USER root

# install docker cli
RUN apt-get -y update; apt-get install -y sudo; apt-get install -y git wget
RUN echo "Jenkins ALL=NOPASSWD: ALL" >> /etc/sudoers
RUN wget http://get.docker.com/builds/Linux/x86_64/docker-latest.tgz
RUN tar -xvzf docker-latest.tgz
RUN mv docker/* /usr/bin/

USER jenkins

Finally, I had problems setting permissions for the Docker socket. Because while that -v flag I mentioned in the OP does cause some docker.sock to be mapped into the Jenkins container, I can't find it on the host system or in WSL, so I can't set its permissions. If it's some virtual file that actually redirects to \\.\pipe\docker_engine, that may be impossible. There was a [post](Bind to docker socket on Windows) with a great many answers about this. The only one applicable to my case of running a Linux container on a Windows host was to start the container with --user root. I'll have to investigate whether that's okay security-wise for us.

So, the final commands to start the container are

$ docker build -f ./Dockerfile.jenkins -t jenkins-docker:latest .
$ docker run --name jenkins-docker -p 8080:8080 -v //var/run/docker.sock:/var/run/docker.sock --user root jenkins-docker:latest
Reasons:
  • Blacklisted phrase (1): did not work
  • RegEx Blacklisted phrase (1.5): I'm new
  • Long answer (-1):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: LemongrabThree