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

Blueocean Docker Pipeline Failed | Cannot start docker container

    Details

    • Similar Issues:

      Description

      I started docker container using the specified switch using below command:

      docker run -p 8888:8080 --group-add docker jenkinsci/blueocean:latest

      But getting this error during pipeline execution.

      [jenkin-test_master-MXNJBW333G3XAISBGXCTVVZGS4GJ5DS6V6NEEORWPSORGJY5OCGA] Running shell script
      + docker pull php
      Using default tag: latest
      Warning: failed to get default registry endpoint from daemon (Cannot connect to the Docker daemon. Is the docker daemon running on this host?). Using system default: https://index.docker.io/v1/
      Cannot connect to the Docker daemon. Is the docker daemon running on this host?
      script returned exit code 1

        Attachments

          Activity

          Hide
          halkeye Gavin Mogan added a comment -

          I'm pretty sure you can use `--group-add` (I have it setup on my instance, I just forgot if this is why)

          on my system docker group is 978 `getent group docker | awk -F: '{print $3}'`

          so the following will make the jenkins user (which the container runs as) also have the GID of 978

          docker run -v /var/run/docker.sock:/var/run/docker.sock --group-add 978 -p 8080:8080 --name jenkins_blueocean jenkinsci/blueocean:latest
          Show
          halkeye Gavin Mogan added a comment - I'm pretty sure you can use `--group-add` (I have it setup on my instance, I just forgot if this is why) on my system docker group is 978 `getent group docker | awk -F: '{print $3}'` so the following will make the jenkins user (which the container runs as) also have the GID of 978 docker run -v / var /run/docker.sock:/ var /run/docker.sock --group-add 978 -p 8080:8080 --name jenkins_blueocean jenkinsci/blueocean:latest
          Hide
          halkeye Gavin Mogan added a comment -

          I just tried it on my ubuntu laptop, group-add 999 and seems to work.

           

          Show
          halkeye Gavin Mogan added a comment - I just tried it on my ubuntu laptop, group-add 999 and seems to work.  
          Hide
          halkeye Gavin Mogan added a comment -

          I think the key is --group-add takes in a GID, not a group name

          Show
          halkeye Gavin Mogan added a comment - I think the key is --group-add takes in a GID, not a group name
          Hide
          halkeye Gavin Mogan added a comment -

          My bad, it does take in groups, but maps it to the containers group name, not the host's group names

          docker run --rm -v /var/run/docker.sock:/var/run/docker.sock --group-add 999 -p 8080:8080 --name jenkins_blueocean --entrypoint "" jenkinsci/blueocean:latest id 
          
          uid=1000(jenkins) gid=1000(jenkins) groups=1000(jenkins),999(ping) 

          vs

          docker run --rm -v /var/run/docker.sock:/var/run/docker.sock --group-add 999 -p 8080:8080 --name jenkins_blueocean --entrypoint "" jenkinsci/blueocean:latest id
            
          uid=1000(jenkins) gid=1000(jenkins) groups=1000(jenkins),999(ping)
          
          Show
          halkeye Gavin Mogan added a comment - My bad, it does take in groups, but maps it to the containers group name, not the host's group names docker run --rm -v / var /run/docker.sock:/ var /run/docker.sock --group-add 999 -p 8080:8080 --name jenkins_blueocean --entrypoint "" jenkinsci/blueocean:latest id uid=1000(jenkins) gid=1000(jenkins) groups=1000(jenkins),999(ping) vs docker run --rm -v / var /run/docker.sock:/ var /run/docker.sock --group-add 999 -p 8080:8080 --name jenkins_blueocean --entrypoint "" jenkinsci/blueocean:latest id    uid=1000(jenkins) gid=1000(jenkins) groups=1000(jenkins),999(ping)
          Hide
          alcmaeon Enrique Diaz added a comment - - edited

          That solved one issue, but now I get the following problem:
          + docker inspect -f . node:6-alpine

          Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.39/containers/node:6-alpine/json: dial unix /var/run/docker.sock: connect: permission denied[Pipeline] isUnix[Pipeline] sh
          -------------------------
          The usual comment to address this is to do ---> sudo usermod -a -G docker $USER

          But that is not an option in mac. Any suggestions?

          Kind Regards.

          Show
          alcmaeon Enrique Diaz added a comment - - edited That solved one issue, but now I get the following problem: + docker inspect -f . node:6-alpine Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.39/containers/node:6-alpine/json : dial unix /var/run/docker.sock: connect: permission denied [Pipeline] isUnix [Pipeline] sh ------------------------- The usual comment to address this is to do ---> sudo usermod -a -G docker $USER But that is not an option in mac. Any suggestions? Kind Regards.

            People

            • Assignee:
              Unassigned
              Reporter:
              shashwat Shashwat Tripathi
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: