Jenkins + Docker: How to control docker user when using Image.inside command

前端 未结 2 1578
时光取名叫无心
时光取名叫无心 2021-02-03 20:29

Dear Stackoverflow Community,

I am trying to setup a Jenkins CI pipeline using docker images as containers for my build processes. I am defining a Jenkinsfile to have a

2条回答
  •  梦谈多话
    2021-02-03 21:01

    I found you can actually change user by adding args like following. Although -u 1000:1000 will still be there in the docker run, you will an additional -u [your user] after 1000:1000. Docker will acutally use latest -u parameter

    agent {
      docker {
        image 'your image'
        args '-u root --privileged'
      }
    }
    

提交回复
热议问题