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

docker exec runs as root within docker.image.inside which docker run runs as the jenkins user

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • docker-workflow-plugin
    • None
    • Jenkins ver. 2.138.2

      A docker.image.inside block causes Jenkins to run a 'docker run ... cat' command and later a docker exec command. The run command runs as the Jenkins user (specifically with the same uid), while docker exec runs as root. The result is that files created withing the inside block has root owners in the workplace, causing issues in later stages.

      I would expect the opposite behavior. "docker run ... cat" should run as root, in order to be able to initialize the docker container. Specifically I have to create a user with the same uid as the jenkins user of the agent (otherwise sudo, ssh will not work). On the other hand docker exec, which does the actual build job, should run under the jenkins user uid, so the owner of the newly created files in mounted directories is the jenkins user.

            Unassigned Unassigned
            hontvari HONTVÁRI Levente
            Votes:
            4 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: