maxfields2000 / dockerjenkins_tutorial

A repository for items learned in my Getting Started with Jenkins and Docker tutorial series
Apache License 2.0
737 stars 325 forks source link

Question: Run docker (docker-compose) inside slaves? #39

Closed chucky2305 closed 7 years ago

chucky2305 commented 7 years ago

How can i run docker or even docker-compose inside of a slave?

Kind regards, Max

maxfields2000 commented 7 years ago

You have a couple of choices. First you'd have to install the Docker Client and Docker-Compose into your Dockerfile for the slave image.

Next you need to decide what DockerHost you want to use. I typically have a seperate dockerhost running for that. You can however use your own dockerhost, you'd have to modify The docker slave template in the Jenkins config to mount /var/run/docker.sock into every container you run, then you could use the local docker socket to make your "Docker build" calls. OR if you know the IP of your dockerhost (in the demos case it's your local desktop) just set your DOCKER_HOST environment variable to that port. If you're using Docker TLS you'd have to have the docker cert keys as well.