Im trying to run a pipeline job on jenkins based on a jenkins and docker file. As described in the following documentation: https://jenkins.io/doc/book/pipeline/docker/
Dockerfile (for a vuejs based project):
FROM node:8
RUN apt-get update -y
# Puppeteer/Chrome headless deps
RUN apt-get install -yq \
gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \
libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 \
libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 \
libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 \
libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 \
libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 \
lsb-release xdg-utils wget
# Cypress deps
RUN apt-get install -y \
libnotify-dev \
xvfb
Jenkinsfile:
pipeline {
agent { dockerfile true }
stages {
stage('Test') {
steps {
sh 'node --version'
sh 'npm --version'
}
}
}
}
When running the job everything seems to go fine till the following error shows up:
java.io.IOException: Failed to run image 'da68b2108e7bcfc2b9c0a6aff8b164ceb8d0da13'. Error: docker: Error response from daemon: Mounts denied:
The paths /var/root/.jenkins/workspace/test-job@tmp and /var/root/.jenkins/workspace/test-job
are not shared from OS X and are not known to Docker.
You can configure shared paths from Docker -> Preferences... -> File Sharing.
See https://docs.docker.com/docker-for-mac/osxfs/#namespaces for more info.
.
at org.jenkinsci.plugins.docker.workflow.client.DockerClient.run(DockerClient.java:133)
at
...
Question: Docker: Mounts denied. The paths ... are not shared from OS X and are not known to Docker does not lead me to a solution.
Update When I am trying to force docker to use a different folder, e.g. by giving run args to the docker run command:
agent {
docker {
image 'da68b2108e7bcfc2b9c0a6aff8b164ceb8d0da13'
args '-v /Users/../../dev'
}
}
These seem to be ingored:
[Pipeline] withDockerContainer
Jenkins does not seem to be running inside a container
$ docker run -t -d -u 0:0 -v /Users/../../dev -w /var/root/.jenkins/workspace/test-job -v /var/root/.jenkins/workspace/test-job:/var/root/.jenkins/workspace/test-job:rw,z -v /var/root/.jenkins/workspace/test-job@tmp:/var/root/.jenkins/workspace/test-job@tmp:rw,z -e