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

Blueocean Docker Pipeline Failed | Cannot start docker container

      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

          [JENKINS-46799] Blueocean Docker Pipeline Failed | Cannot start docker container

          Shashwat Tripathi created issue -
          Shashwat Tripathi made changes -
          Environment New: OS: Windows 10 x64

          Running Blueocean using Docker as stated here
          https://jenkins.io/doc/book/blueocean/getting-started/

          Hi there!

          I'm able to start a docker inside jenkins using this commands:

          docker pull jenkinsci/blueocean
          docker run -u root -v /var/run/docker.sock:/var/run/docker.sock -p 8080:8080 -p 2375:2375 --name jenkins_blueocean jenkinsci/blueocean:latest
          

          I know that running jenkins with root user isn't the desired solution but for now it works for my purposes.

          Please remember to also activate the config "Expose daemon on tcp://localhost:2375 without TLS".

          Best regards,

          mtocchetto

          Marcelo Tocchetto added a comment - Hi there! I'm able to start a docker inside jenkins using this commands: docker pull jenkinsci/blueocean docker run -u root -v / var /run/docker.sock:/ var /run/docker.sock -p 8080:8080 -p 2375:2375 --name jenkins_blueocean jenkinsci/blueocean:latest I know that running jenkins with root user isn't the desired solution but for now it works for my purposes. Please remember to also activate the config "Expose daemon on tcp://localhost:2375 without TLS". Best regards, mtocchetto

          Marcelo Tocchetto added a comment - - edited

          I believe that the solution below also works:

          docker pull jenkinsci/blueocean
          docker run -v /var/run/docker.sock:/var/run/docker.sock -p 8080:8080 --name jenkins_blueocean jenkinsci/blueocean:latest
          

          Press Ctrl+C and then:

          docker exec -u root -ti jenkins_blueocean bash
          chown :jenkins /var/run/docker.sock
          

          Best regards,
          mtocchetto

          Marcelo Tocchetto added a comment - - edited I believe that the solution below also works: docker pull jenkinsci/blueocean docker run -v /var/run/docker.sock:/var/run/docker.sock -p 8080:8080 --name jenkins_blueocean jenkinsci/blueocean:latest Press Ctrl+C and then: docker exec -u root -ti jenkins_blueocean bash chown :jenkins /var/run/docker.sock Best regards, mtocchetto

          James Dumay added a comment -

          Thanks for the advice here mtocchetto. This is the right way to run docker within a docker container.

          James Dumay added a comment - Thanks for the advice here mtocchetto . This is the right way to run docker within a docker container.
          James Dumay made changes -
          Resolution New: Not A Defect [ 7 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]
          Jenn Briden made changes -
          Status Original: Resolved [ 5 ] New: Closed [ 6 ]

          Enric Prats added a comment - - edited

          mtocchetto workaround is good but people should not have to change the docker image once downloaded and running. 

          This should be changed on the Dockerfile which builds the image.

           

          It's enough to add to the Jenkinsfile:

              # Allow Jenkins to run docker commands

              chown :jenkins /var/run/docker.sock

           

          I will try to figure how to make the pull request but I have never made one

          Enric Prats added a comment - - edited mtocchetto workaround is good but people should not have to change the docker image once downloaded and running.  This should be changed on the Dockerfile which builds the image.   It's enough to add to the Jenkinsfile:     # Allow Jenkins to run docker commands     chown :jenkins /var/run/docker.sock   I will try to figure how to make the pull request but I have never made one
          Enric Prats made changes -
          Resolution Original: Not A Defect [ 7 ]
          Status Original: Closed [ 6 ] New: Reopened [ 4 ]
          Enric Prats made changes -
          Priority Original: Major [ 3 ] New: Minor [ 4 ]

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

              Created:
              Updated:
              Resolved: