Jenkins Slave
Jenkins Slave
Jenkins Slave
Step 1: Spin up a VM, and install docker on it. You can follow the
official documentation for installing docker. based on the Linux
distribution you use. Make sure the docker service is up and running.
Step 2: Log in to the server and open the docker service
file /lib/systemd/system/docker.service . Search for ExecStart and replace
that line with the following.
ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:4243 -H
unix:///var/run/docker.sock
Step 3: Reload and restart docker service.
sudo systemctl daemon-reload
sudo service docker restart
Step 4: Validate API by executing the following curl commands.
Replace 54.221.134.7 with your host IP.
curl http://localhost:4243/version
curl http://54.221.134.7:4243/version
Check the docker remote API article for a detailed explanation of
Docker API.
Once you enabled and tested the API, you can now start building the
docker slave image.
If you are planning to run docker in docker for your CI process, you
can mount the host docker.sock as volume to execute docker
commands. Check out my article on running docker in docker to know
more about it.
Test Docker Slaves Using FreeStyle Job
Now that you have the slave configurations ready,
You can check the build logs in your jobs console output as shown
below.
Also, you can check out the video explaining the whole process.