I'm having an issue where a jenkins agent can't access Docker, and I'm just about ready to give up but I figured I'd try asking here first.
Along with the official documentation, I've also been using this guide to help me setup using docker compose, and also with an agent.
The agent is however unable to access docker. Actually it also didn't have git installed, so I had to install that. Actually apt was broken in the image so I had to fix that after installing it and install again. I extended the image as follows because this was getting painful:
FROM jenkins/ssh-agent:jdk11
RUN apt update
RUN sh -c 'apt install -y git-all || true'
RUN mv /var/lib/dpkg/info/install-info.postinst /var/lib/dpkg/info/install-info.postinst.bad
RUN apt install -y git-all
The jenkins/ssh-agent:jdk11 image is the official image from Jenkins for an agent node, which surprised me when I double-checked that.
I tried adding these volumes to it in the docker-compose file:
volumes
- /var/run/docker.sock:/var/run/docker.sock
- /usr/bin/docker:/usr/bin/docker
and that didn't work. I tried adding a jenkins user on my host so I could sudo usermod -a -G docker jenkins (in case that's where the check would happen).