DEV Community

Discussion on: Jenkins Build Agents as Docker Swarm Services

Collapse
 
roylarsen profile image
Roy Larsen

So, the JNLP agent is the Jenkins Agent.

When you first go to create the Docker Template, Jenkins fills out some information for you. If your container has curl installed in it, the command that gets auto-filled out will reach out to the Master instance, and grab the agent and run it. If you don't have curl in your container, you could build a container that already has the JNLP agent in it (the GitHub repo from Jenkins I liked to has examples of that) and use the command I have above for the python container.

I haven't been playing around with running things from our private registry yet, but it looks pretty straight forward. In the image line you put the image ref like you would in a compose file, then there's a button at the bottom of the template section to add registry authentication, you just have to have the registry stuff as Jenkins credentials already.

For host constraints, there's a 'Placement' button that you can restrict where containers are run

Placement constraints, separated by semi-colon (;). e.g

node.role!=manager;node.hostname!=node-2