Reputation: 19232
I am not very familiar with the Jenkins Docker Plugin and this might really be my issue. But right now my issue is that I am expecting the Docker Plugin to Spin up a Container on my Docker Host, I have configured my Docker Host as a Cloud in the Jenkins Configuration for Docker Plugin and Docker Plugin can connect to my Docker Host when I press "Test Connection":
I am using a very common Docker Image on Docker Hub as a Slave, not that really matters at this point because the Docker Plugin is not even trying to spin up a Docker container slave:
Here is the configuration for my simple Jenkins job that runs, pulls source code and finishes without error, never spinning up a Slave Container at any point towork:
Here is the output of the Job running without error:
Here is my Jenkins Master Dockerfile
#reference
#https://engineering.riotgames.com/news/putting-jenkins-docker-container
FROM jenkins:2.46.3
MAINTAINER Brian Ogden
#setup folder for jenkins to log and save war file to
USER root
RUN apt-get update && apt-get install -y make apt-transport-https ca-certificates curl gnupg2 software-properties-common
RUN curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
RUN add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
RUN apt-get update && apt-get install -y docker-ce
RUN mkdir /var/log/jenkins
RUN mkdir /var/cache/jenkins
RUN chown -R jenkins:jenkins /var/log/jenkins
RUN chown -R jenkins:jenkins /var/cache/jenkins
RUN gpasswd -a jenkins docker
USER jenkins
#give Jenkins a nice 8 GB memory pool and room to handle garbage collection
#ENV JAVA_OPTS="-Xmx8192m"
#give Jenkins a nice base pool of handlers and a cap
#ENV JENKINS_OPTS="--handlerCountStartup=100 --handlerCountMax=300"
ENV JENKINS_OPTS="--logfile=/var/log/jenkins/jenkins.log --webroot=/var/cache/jenkins/war"
Here is a diagram of what I am trying to achieve ultimately:
Upvotes: 1
Views: 2272
Reputation: 19232
Ok I figured it thanks to this article. As I suspected it was my Jenkins Docker Plugin Configuration settings.
First I had to give my slave Docker Template image a label:
Then I had to change my Jenkins Build project configuration to:
Now Docker Plugin is provisioning a slave container on my Docker host
Upvotes: 2