K
Q

Jenkins: running docker commands on a docker slave

July 21, 2016

I'm using the Kubernetes Jenkins plugin to orchestrate jenkins slaves

I want to run all the jobs in Docker (build docker images and execute tests/builds in docker).

example jenkins job:

docker run -e NEXUS_USERNAME=${NEXUS_USERNAME} -e NEXUS_PASSWORD=${NEXUS_PASSWORD} common-dropwizard:latest mvn deploy

I am using the jenkinsci/jnlp-slave from here: https://hub.docker.com/r/jenkinsci/jnlp-slave/

Unfortunately, the slave image doesn't appear to support running docker. My question is what is the best approach to accomplish this?

thanks

-- phil swenson
jenkins
docker
kubernetes

1 Answer

July 22, 2016

You need to install docker client and mount the docker socket so you can access the Docker host. Then you can interact with that Docker host

https://jpetazzo.github.io/2015/09/03/do-not-use-docker-in-docker-for-ci/ https://github.com/jenkinsci/docker-workflow-plugin/tree/master/demo

-- csanchez
Source: StackOverflow