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

docker.inside() cannot run container as privileged

      I tried to run a privileged Docker container with the Jenkins declarative pipeline (following this answer: https://stackoverflow.com/questions/52409836/how-to-run-a-privileged-docker-container-with-the-jenkins-declarative-pipeline), by passing the "privileged" flag to the inside() function.

      The container is running but not in the privileged mode. Is there any way to make it work?

      My pipeline config is like this:

      stage('Test'){
        steps {
          script {
            docker.image(DOCKER_REGISTRY + ":$BUILD_NUMBER").inside("--privileged -v /var/run/docker.sock:/var/run/docker.sock")

      {         sh '''. /usr/local/bin/test.sh'''       }

          }
        }
      }

          [JENKINS-55631] docker.inside() cannot run container as privileged

          Qijun Liu created issue -
          Qijun Liu made changes -
          Description Original: I tried to run a privileged Docker container with the Jenkins declarative pipeline (following this answer: [https://stackoverflow.com/questions/52409836/how-to-run-a-privileged-docker-container-with-the-jenkins-declarative-pipeline)]

          The container is running but not in the privileged mode. Is there any way to make it work?

          My pipeline config is like this:

          stage('Test'){
            steps {
              script {
                docker.image(DOCKER_REGISTRY + ":$BUILD_NUMBER").inside("--privileged -v /var/run/docker.sock:/var/run/docker.sock") {
                  sh '''. /usr/local/bin/test.sh'''
                }
              }
            }
           }
          New: I tried to run a privileged Docker container with the Jenkins declarative pipeline (following this answer: [https://stackoverflow.com/questions/52409836/how-to-run-a-privileged-docker-container-with-the-jenkins-declarative-pipeline)], by passing the "privileged" flag to the inside() function.

          The container is running but not in the privileged mode. Is there any way to make it work?

          My pipeline config is like this:

          stage('Test'){
            steps {
              script {
                docker.image(DOCKER_REGISTRY + ":$BUILD_NUMBER").inside("--privileged -v /var/run/docker.sock:/var/run/docker.sock")

          {         sh '''. /usr/local/bin/test.sh'''       }

              }
            }
          }
          Andrew Bayer made changes -
          Component/s New: docker-workflow-plugin [ 20625 ]
          Component/s Original: pipeline-model-definition-plugin [ 21706 ]
          Andrew Bayer made changes -
          Assignee Original: Andrew Bayer [ abayer ]

            Unassigned Unassigned
            yufuluo Qijun Liu
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: