Hi there, I have a machine A that runs Jenkins and Bitbucket-server in docker containers. I have a machine B, that just has docker listening over tcp. I have a project that uses Declarative pipeline with "agent { docker 'foobar:X.Y'}" I'm using "jenkinsci/blueocean:latest" docker image with "docker-workflow v1.15" plugin.
Ignoring machine B (for now), my setup is working: - 1. A dev open a pull-request on bitbucket - 2. The declarative pipline is executed by jenkins - 3. The docker container(s) specified in the Jenkinsfile are executed by machine A - 4. The pipeline finished - 5. Jenkins notify Bitbucket. >From a docker point of view, for the above to work, I simply need to run the Jenkins container with --volume /var/run/docker.sock:/var/run/docker.sock Now, I would like to achieve 3 things: - Leave machine A runs non-build services only - Use machine B to spawn containers as directed by declarative pipelines. - Eventually make machine B a docker swarm manager, and let other docker swarm workers join in if/when needed. The first modification I did to the jenkins container is to remove the "/var/run/docker.sock" volume. This is to make sure jenkins can only talk to the remote docker I configure. I have then tried 3 plugins: - "docker plugin" https://plugins.jenkins.io/docker-plugin - "docker swarm" https://plugins.jenkins.io/docker-swarm - "Yet another docker plugin" https://plugins.jenkins.io/yet-another-docker-plugin All of them add a type of "cloud providers", but I never managed to get my pipeline executed using one. The "docker plugin" is the only one that gave me the feeling I was almost there: The job was handled by a docker container spawn on machine B, which i had to specify the image name (From examples and tutorials, i settled down on "jenkinsci/jnlp-slave" in "Launch attached" mode). But at that stage, I got an error "docker: command not found" emitted from the jnlp-slave container. The reason being that Jenkins master contacted docker on machine B to execute a "jenkinsci/jnlp-slave", and then ask this "jenkinsci/jnlp-slave" to execute the pipeline, which is an operation that requires to instantiate the docker containers specified in the project's pipeline... So I would like to know if the "docker-plugin" is the right tool for my job or should I head in another direction. In case "docker-plugin" is the way to go, then how do I tell my customised jnlp-slave to connect to the right docker daemon? Is there an off-the-shelf docker image to play that role? I couldn't find documentation on how to create it, and the specificites of having docker inside it. As a side note: I found a bit inefficient to have to instantiate Jenkins slave container whose sole purpose is to read the pipeline and spawn containers as directed by the pipeline. Ideally I would like the pipeline to be parsed by Machine A (jenkins master) and the required containers to be executed on machine B, I do not know if volumes (jenkins workspace) can be shared across 2 docker daemons thought... Any opinion or advice are very welcome, point-out of any sort would be greatly appreciated too. Thanks, Chris -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CABxGUTgbu2BPOO1MRcPVPaxqqGhe306kU_LBAWf3H2jO2RooFA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.