Mohamed Thoufeeque
Mohamed Thoufeeque

Reputation: 876

How to run a docker image in jenkins which is already in Docker Container

I need to run my own docker image in jenkins pipeline job and my jenkins is already running in a container?

Is there any possible way to do it?

Upvotes: 1

Views: 1423

Answers (2)

ludenus
ludenus

Reputation: 1341

Another approach is to configure jenkins slave so that child docker containers are invoked on the same docker host as jenkins slave siblings, and not inside dockerized jenkins slave.

This approach has certain limitations (e.g. when mounting folders) but avoids running nested dockers.

docker run -v /var/run/docker.sock:/var/run/docker.sock

Details are here: https://jpetazzo.github.io/2015/09/03/do-not-use-docker-in-docker-for-ci

Upvotes: 1

Yaron Idan
Yaron Idan

Reputation: 6765

There are a number of docker images built exactly for this purpose. Try this one for example - https://hub.docker.com/r/tehranian/dind-jenkins-slave/

Upvotes: 0

Related Questions