jenkinsci / jenkinsci/docker-workflow-plugin

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

Open
#597 0 comments 0 reactions 0 assignees View on GitHub
component:docker-workflow-plugin imported-jira-issue priority:minor resolution:unresolved
Dominant language
Java
Stars
527
Forks
422
Avg merge
10m
Merged PRs (30d)
1

Description

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'''       }

    }

  }

}

---
Originally reported by yufuluo, imported from: docker.inside() cannot run container as privileged


  • status: Open
  • priority: Minor
  • component(s): docker-workflow-plugin
  • resolution: Unresolved
  • votes: 1
  • watchers: 3
  • imported: 2025-12-07

Raw content of original issue

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'''       }

    }
  }
}

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.