jenkinsci / jenkinsci/docker-workflow-plugin

[JENKINS-49416] Agent Dockerfile Overrides Entrypoint and User

Open
#554 1 comment 0 reactions 0 assignees View on GitHub
component:docker-workflow-plugin enhancement imported-jira-issue pipeline priority:minor resolution:unresolved
Dominant language
Java
Stars
527
Forks
422
Avg merge
10m
Merged PRs (30d)
1

Description

 

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.

---
Originally reported by sysadmind, imported from: Agent Dockerfile Overrides Entrypoint and User


  • status: Open
  • priority: Minor
  • component(s): docker-workflow-plugin
  • label(s): docker, pipeline
  • resolution: Unresolved
  • votes: 3
  • watchers: 3
  • imported: 2025-12-07

Raw content of original issue

 

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.

environment

```
Jenkins 2.89.3

docker-workflow 1.15 (Also tried 1.14)

Docker version 17.12.0-ce, build c97c6d6
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.