Installing dock-related plugin
System Management-Plug-in Management-Optional Plug-in
Docker Slaves Plugin
Configure docker Plug-ins
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
System Management-System Settings-Cloud-New Cloud
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.
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.
Docker-maven-plugin is not used here, but a mirror image is built directly in the shell according to Dockerfile.