How to disable default user name for docker agent

pipeline {
agent {
docker {
image ‘dummy_image:latest’
args "-u root:root "

stages {
    stage('stage') {
        steps {
            script {

                checkout scmGit(branches: [[name: '*/main']], extensions: [], userRemoteConfigs: [[credentialsId: 'douglas_id', url: 'giturl']])


here is my pipeline that uses docker agent, when I run the pipeline,
the generated docker run command is
docker run -t -d -u 9110:100 -u root:root dummy_image:latest cat

id in the pipeline shows user info for root which means root uses logs in the docker container

but after checkout command is run, the owner of the downloaded git project files is user 9110, it is so strange, why is not their owner root?

how to disable -u 9110:100, I do not want this user to login docker container

1 Like

If you need special control such as setting the user id in the container, you cannot use agent docker which is only suitable for the simplest cases. Use agent label picking up a computer with Docker installed, and run docker CLI commands directly.

1 Like