Jenkins Builds docker Mirror

  docker, jenkins

Installing dock-related plugin

System Management-Plug-in Management-Optional Plug-in

  • Docker plugin

  • Docker Slaves Plugin

  • docker-build-step

Configure docker Plug-ins

Build docker-http-proxy

Expose docker’s api in http

docker run --rm \
    -p 2375:2375 \
    --name shipyard-proxy \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -e PORT=2375 \
    shipyard/docker-proxy:latest

Building jenkins-slave image

You can refer todind-jenkins-slaveSelf-defining

Configure cloud

System Management-System Settings-Cloud-New Cloud

图片描述

  • docker url
    Here is tcp://192.168.99.100:2375, the port here is the port of the above docker-http-proxy agent, and the ip is the address of docker-machine

You can test through test connection.

  • Add template

The image here is the docker image of jenkins-slave.
Labels here are marked as docker-agent, that is, the name of node for this jenkins slave.
The Credentials of Launch method here are jenkins/jenkins.

Configure job

Select node
图片描述

structure
图片描述

Docker-maven-plugin is not used here, but a mirror image is built directly in the shell according to Dockerfile.

doc