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

Agent Dockerfile Overrides Entrypoint and User

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • docker-workflow-plugin
    • Jenkins 2.89.3
      docker-workflow 1.15 (Also tried 1.14)
      Docker version 17.12.0-ce, build c97c6d6

       

      I am running a project build inside the docker container build from the repo's Dockerfile. This dockerfile has an entrypoint that is respectful of commands being passed in as has been discussed on similar issues recently. The entrypoint starts a few services that are necessary for the build steps. Jenkinsfile:

      #.Jenkinsfile
      pipeline {
      agent { dockerfile true }
      
        stages {
          stage('Build') {
            steps {
              sh 'echo whoami'
              sh 'ps -ef'
            }
          }
        }
      }

       

      The problem is that the steps get run in the docker container, but the user and entrypoint are both overridden with no option that I can find to change that behavior. I think this breaks what a new user like myself would expect to happen and there doesn't seem to be any documentation to warn of this or to work around this. 

      Looking at the console output, it appears the plugin infers to add withDockerContainer somewhere before the steps execute. This step may be hard to replicate since the plugin knows how to build the dockerfile and use that resulting image for the rest of the steps.

      There should be some way to avoid the overriding of the user and entrypoint when running from a dockerfile or at least a documented workaround.

            Unassigned Unassigned
            sysadmind Joe Adams
            Votes:
            3 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: