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

前端 未结 2 1574
时光取名叫无心
时光取名叫无心 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:26

    As you can see here or here is hardcoded the fact of append the uid and gid of the user that is running Jenkins (in your case, the Jenkins user created inside the oficial docker image).

    You can change the user that runs the processes inside your Jenkins image passing the --user (or -u) argument to the docker run command. Maybe this can minimize your problems.

    Edited

    how can I change this behavior? Is there a switch where I can turn the -u 1000:1000 off?

    You can't change this behaviour in the actual version because the whoami is hardcoded.

    Is this even a bug?

    In this pull request seems that they are working on it.

    However, is there another simple way to get to my goal if the Docker Plugin is not usable?

    The new pipeline plugin version that comes with Jenkins also use the docker-workflow-plugin to run the containers. I don't know another plugin to run that in a simple way. To workaround this, you can run your Jenkins as root but is a very ugly solution.

提交回复
热议问题