Saturday, September 23, 2017

User Docker Agents with Jenkins

I am running Jenkins in my home lab in docker container. I wanted to also have different agents for the different types of projects I was building, like building some of my Arduino projects for the different boards I have, or nodejs packages, etc.

I have the Jenkins Cloud Plugin and docker-plugin installed. I was having some issues configuring it to connect to the docker api, and the plugin documentation is out dated.

Since this is my lab, I just set up for TCP communication vs the docker.sock. The documentation says to edit the /etc/init/docker.conf. Except on Ubuntu 16.04 that is not used.

Instead, you have to edit /lib/systemd/system/docker.service and add -H 0.0.0.0:32376 to ExecStart.

Run systemctl daemon-reload

And finally, systemctl restart docker

Now docker engine will restart and it will be listening on port 32376. If you do curl –XGET http://localhost:32376 you should get a response.

You can now configure jenkins to use tcp://<docker-host>:32376 and hit test connection.

User Docker Agents with Jenkins

I am running Jenkins in my home lab in docker container. I wanted to also have different agents for the different types of projects I was building, like building some of my Arduino projects for the different boards I have, or nodejs packages, etc.

I have the Jenkins Cloud Plugin and docker-plugin installed. I was having some issues configuring it to connect to the docker api, and the plugin documentation is out dated.

Since this is my lab, I just set up for TCP communication vs the docker.sock. The documentation says to edit the /etc/init/docker.conf. Except on Ubuntu 16.04 that is not used.

Instead, you have to edit /lib/systemd/system/docker.service and add -H 0.0.0.0:32376 to ExecStart.

Run systemctl daemon-reload

And finally, systemctl restart docker

Now docker engine will restart and it will be listening on port 32376. If you do curl –XGET http://localhost:32376 you should get a response.

You can now configure jenkins to use tcp://<docker-host>:32376 and hit test connection.