Commandline, docker, linux, provisioning, tooling

jenkins with ansible,terraform,libvirt-clients and docker in docker


Create this Dockerfile:

FROM jenkins/jenkins
USER root
RUN apt-get -y update && \
 apt-get -y install libvirt-clients curl software-properties-common lsb-release ansible apt-transport-https ca-certificates gnupg-agent  &&  curl -fsSL | apt-key add - && \
 add-apt-repository  "deb [arch=amd64] $(lsb_release -cs) main" && \
 curl -fsSL | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg && \
 echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] \
 $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null && \
 apt-get update && \
 apt-get -y install docker-ce docker-ce-cli terraform && \
 curl -L "$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
USER jenkins

Build the docker file with the command

docker build -t jenkins/libvirt_terraform_docker:1.0

Then start you container with the command:

docker run --name jenkins -d -v /volume1/docker/jenkins/data/:/var/jenkins_home -v /var/run/docker.sock:/var/run/docker.sock -p 8080:8080 -p 50000:50000 jenkins/libvirt_terraform_docker:1.0

Thanks for :

Back to top