1.安装安装docker;
2.安装jenkins:
docker run -u root -d -p 8000:8080 -p 50000:50000 -v /var/jenkins_home:/var/jenkins_home -v /var/run/docker.sock:/var/run/docker.sock -v $(which docker):/usr/bin/docker --name jenkinsmaster jenkins/jenkins:lts
3.安装Jenkins插件:Docker Pipeline
4.创建job配置pipline:
pipeline {
agent {
docker { image 'node:7-alpine' }
}
stages {
stage('Test') {
steps {
sh 'node --version'
}
}
}
}