So today I wanted to add a builder image for Neigh Dev to test the Jekyll build before actually committing to Github.

This is the command I tried:

docker run --rm --volume="./github:/srv/jekyll:Z" jekyll/builder:pages ls -all

And it didn't work, it started however the volume was empty!

So it turns that, as I am running the Jenkins agent in docker, any docker --volume command I give it points to the filesystem of the docker host. Not that of the agent I am running in.

Because the workspace path in the agent image was still available on the host I have just mounted the path one on one. This makes everything a lot easier. Be sure to change the permissions on the host so the Jenkins user has access rights. (chown 1000:1000 on the workspace did it for me).

Below mounts are for the Jenkins Agent, not for the Jekyll image I was trying to run before.

    volumes: 
     - /var/run/docker.sock:/var/run/docker.sock
     - /home/jenkins/agent/workspace:/home/jenkins/agent/workspace