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

Impossible to specify user/uid to use inside container

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Minor Minor
    • docker-workflow-plugin
    • None
    • docker-pipeline-plugin:1.15
      Jenkins 2.105 in docker container

      When launching the docker agent, the following option is always added to the command line.
      -u 1000:1000
      It can be problematic if we want to use a specifically configured user inside the docker container agent, since adding a -u option in the args results in an unexpected command.

      It would be very useful to have an option to specify the user mapping inside the container.

          [JENKINS-49437] Impossible to specify user/uid to use inside container

          Vi Pl added a comment - - edited

          Seeing something similar:

          This:

           

          docker.image(image).inside('-u 0:0') {
           sh "..."
          }

          Results in:

          [Pipeline] withDockerContainer
          Jenkins seems to be running inside container e50594031f5a4017ed56c0842e4b546c8e1559caaf5c68549aeb541da3d70142
          $ docker run -t -d -u 1000:1000 -u 0:0 -w /var/jenkins_home/jobs/test/workspace --volumes-from e50594031f5a4017ed56c0842e4b546c8e1559caaf5c68549aeb541da3d70142 -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** image:0.1

           

           

          I do not expect -u 1000:1000 -u 0:0 ... - The job will fail when writing inside /var/jenkins_home/jobs/test/workspace...

          Vi Pl added a comment - - edited Seeing something similar: This:   docker.image(image).inside( '-u 0:0' ) { sh "..." } Results in: [Pipeline] withDockerContainer Jenkins seems to be running inside container e50594031f5a4017ed56c0842e4b546c8e1559caaf5c68549aeb541da3d70142 $ docker run -t -d -u 1000:1000 -u 0:0 -w / var /jenkins_home/jobs/test/workspace --volumes-from e50594031f5a4017ed56c0842e4b546c8e1559caaf5c68549aeb541da3d70142 -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** image:0.1     I do not expect -u 1000:1000 -u 0:0 ... - The job will fail when writing inside /var/jenkins_home/jobs/test/workspace...

            Unassigned Unassigned
            bgras Benjamin Gras
            Votes:
            3 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: