Docker On Docker
Fork me on GitHub

All Tags:

mindset

devops

book

ci

communication

jenkins

自媒体

hometown

tools

tool

cloud

 

Labs: Pipeline with Dockerfile to run in the Slave Agent Node

Now you have Jenkins installed, If you have a Jenkinsfile try to run stage in a dedicated docker container instance, You have two options to resolve the dependency to docker.


 pipeline {
        //  agent  any

    stages {
        stage('Spell Check') {
                agent {
                    dockerfile {
                        filename 'Dockerfile.mdspell'
                        args '-u="root"'
                        }
                }
        }
    }

 }

Install Docker Within Jenkins Master

Slave Agent Node With Docker installed

For my case, I have Jenkins running as a Docker container in an Azure Ubuntu Linux VM, so in the VM host I already have Docker installed. But within the container of Jenkins, the docker is not installed.

So I specify another VM host with Docker installed as a slave agent node to the Jenkins Master host (192.168.1.1:8080). The Jenkins Master will assign pipeline jobs to the slave agent node to run.

Notes: during my setting up, the log remind me to install Java in the slave agent node.


sudo apt install openjdk-8-jdk