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

Docker agent startup failure when running on rootless docker

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • docker-workflow-plugin
    • None

      Test pipeline:
      pipeline {
          agent none
      
          stages {
              stage('run') {
                  agent {
                      docker {
                          image 'python-3.10.5'
                          label 'docker-rootless'
                      }
                  }
                  steps {
                      sh('echo test')
                  }
              }
          }
      }
      How to reproduce

      If I run the above pipeline on the Ubuntu node with a regular docker-ce install, then the job is successful.

      If I change the Ubuntu agent to run rootless docker, following the guide at https://docs.docker.com/engine/security/rootless/, then the build fails with this error:

      Started by user admin
      [Pipeline] Start of Pipeline
      [Pipeline] stage
      [Pipeline] { (run)
      [Pipeline] node
      Running on ubuntu-rootless-docker in /var/lib/jenkins-agent/agent/workspace/test-docker-rootless-docker
      [Pipeline] {
      [Pipeline] isUnix
      [Pipeline] withEnv
      [Pipeline] {
      [Pipeline] sh
      + docker inspect -f . python:3.10.5-slim
      .
      [Pipeline] }
      [Pipeline] // withEnv
      [Pipeline] withDockerContainer
      ubuntu-rootless-docker does not seem to be running inside a container
      $ docker run -t -d -u 128:134 -w /var/lib/jenkins-agent/agent/workspace/test-docker-rootless-docker -v /var/lib/jenkins-agent/agent/workspace/test-docker-rootless-docker:/var/lib/jenkins-agent/agent/workspace/test-docker-rootless-docker:rw,z -v /var/lib/jenkins-agent/agent/workspace/test-docker-rootless-docker@tmp:/var/lib/jenkins-agent/agent/workspace/test-docker-rootless-docker@tmp:rw,z -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** python:3.10.5-slim cat
      $ docker top 2aad1b12fa63578e2fb54afb232c7601c77afbbe76664dc40a347bc3fbf35cd1 -eo pid,comm
      [Pipeline] // withDockerContainer
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] End of Pipeline
      java.io.IOException: Failed to run top '2aad1b12fa63578e2fb54afb232c7601c77afbbe76664dc40a347bc3fbf35cd1'. Error: Error response from daemon: runc did not terminate successfully: exit status 1: unable to get all container pids: lstat : no such file or directory
      : unknown
      	at org.jenkinsci.plugins.docker.workflow.client.DockerClient.listProcess(DockerClient.java:152)
      	at org.jenkinsci.plugins.docker.workflow.WithContainerStep$Execution.start(WithContainerStep.java:201)
      	at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:322)
      	at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:196)
      	at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:124)
      	at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:47)
      	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
      	at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
      	at org.jenkinsci.plugins.docker.workflow.Docker$Image.inside(Docker.groovy:140)
      	at org.jenkinsci.plugins.docker.workflow.Docker.node(Docker.groovy:66)
      	at org.jenkinsci.plugins.docker.workflow.Docker$Image.inside(Docker.groovy:125)
      	at org.jenkinsci.plugins.docker.workflow.declarative.DockerPipelineScript.runImage(DockerPipelineScript.groovy:54)
      	at org.jenkinsci.plugins.docker.workflow.declarative.AbstractDockerPipelineScript.configureRegistry(AbstractDockerPipelineScript.groovy:63)
      	at org.jenkinsci.plugins.docker.workflow.declarative.AbstractDockerPipelineScript.run(AbstractDockerPipelineScript.groovy:50)
      	at org.jenkinsci.plugins.pipeline.modeldefinition.agent.CheckoutScript.checkoutAndRun(CheckoutScript.groovy:64)
      	at org.jenkinsci.plugins.pipeline.modeldefinition.agent.CheckoutScript.doCheckout(CheckoutScript.groovy:40)
      	at org.jenkinsci.plugins.pipeline.modeldefinition.agent.impl.LabelScript.run(LabelScript.groovy:43)
      	at ___cps.transform___(Native Method)
      	at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:86)
      	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:113)
      	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:83)
      	at jdk.internal.reflect.GeneratedMethodAccessor260.invoke(Unknown Source)
      	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
      	at com.cloudbees.groovy.cps.impl.ClosureBlock.eval(ClosureBlock.java:46)
      	at com.cloudbees.groovy.cps.Next.step(Next.java:83)
      	at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
      	at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
      	at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:136)
      	at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:275)
      	at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
      	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18)
      	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:51)
      	at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:187)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:420)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$400(CpsThreadGroup.java:95)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:330)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:294)
      	at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:67)
      	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      	at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:139)
      	at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
      	at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68)
      	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
      	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      	at java.base/java.lang.Thread.run(Thread.java:829)
      Finished: FAILURE
      

      The only other change made to the rootless docker node is to set

      DOCKER_HOST=unix:///run/user/128/docker.sock  # jenkins-agent uid=128

      in the Node Properties -> Environment Variables configuration section.

            Unassigned Unassigned
            wwuck Tom
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: