Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-58712

Docker tool configuration over Jenkins slaves

    Details

    • Similar Issues:

      Description

      Hi,

      I'm using docker-commons-plugin v.1.13 and jenkins v.1.121.3

      I have several ubuntu (16.04) slaves connected to my jenkins.

       

      My goal is to configure Docker as a global tool, i.e be able to run docker commands without having any docker pkgs on my slaves.

      I configured  the docker-commons-plugin and add it as it written at the GitHub README, but the only thing I able to do is $docker version

      Any attempt to make something practical (i.e. docker build/run/push/...) is over with the following error:

      Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

       

       

      Once again, I do no want to install the docker pkg over my slaves, but only use the docker tool.

      What can I do?

       

      Thanks!

        Attachments

          Activity

          Hide
          pjdarton pjdarton added a comment -

          It doesn't work that way...

          Builds run on slave nodes.
          If your slave nodes don't have the docker client on them and don't have access to a docker daemon then your slave nodes have no docker capabilities, which is why your attempts to use those missing capabilities are failing.
          A machine without the docker daemon on it (and running) can't contain docker containers.
          A machine without a docker client on it can't talk to a docker daemon about docker containers.

          The docker-commons-plugin provides a Java docker client that's used by the docker-plugin to talk to docker daemons, but that capability is there for the Jenkins master and isn't really exposed to the slave nodes.

          If you want to run docker commands as part of a build process on a build slave node then you need to have build slave nodes that have the docker client on them and they either a link to another docker daemon (whether that's via the DOCKER_HOST env var or by cross-mounting /var/lib/docker.sock from the docker host into a docker container) or (to keep things nice and simple and isolated) their own running docker daemon (less efficient, but much simpler as every build gets its own docker daemon, so you don't get nasty collisions).

          TL;DR: If you want docker on your slave nodes, you need to install docker on your slave nodes.

          Show
          pjdarton pjdarton added a comment - It doesn't work that way... Builds run on slave nodes. If your slave nodes don't have the docker client on them and don't have access to a docker daemon then your slave nodes have no docker capabilities, which is why your attempts to use those missing capabilities are failing. A machine without the docker daemon on it (and running) can't contain docker containers. A machine without a docker client on it can't talk to a docker daemon about docker containers. The docker-commons-plugin provides a Java docker client that's used by the docker-plugin to talk to docker daemons, but that capability is there for the Jenkins master and isn't really exposed to the slave nodes. If you want to run docker commands as part of a build process on a build slave node then you need to have build slave nodes that have the docker client on them and they either a link to another docker daemon (whether that's via the DOCKER_HOST env var or by cross-mounting /var/lib/docker.sock from the docker host into a docker container) or (to keep things nice and simple and isolated) their own running docker daemon (less efficient, but much simpler as every build gets its own docker daemon, so you don't get nasty collisions). TL;DR: If you want docker on your slave nodes, you need to install docker on your slave nodes.

            People

            • Assignee:
              Unassigned
              Reporter:
              danielj Daniel Juravski
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: