-
New Feature
-
Resolution: Won't Do
-
Major
It would be nice if it were possible to run steps inside a reusable docker container. The intention is to have different, clean build environments for every build, where dependencies could be installed without affecting the build host or other builds.
Further it would be nice if such a container would "live" throughout the whole build process and the user could decide which step to run inside it and which not (e.g. steps like sonar testing does not need to run inside the container, or maybe these tests should run in a dedicated sonar-container).
The "oki-docki" plugin uses "docker exec" to run commands inside a container which is a nice way of implementation. Accessing such a container from within the workflow plugin would be nice.
The "docker" plugin has dependencies on the docker image (e.g. it needs an installed jre, sshd , etc) which is not nice.
- is duplicated by
-
JENKINS-39746 Allow running exec directly from a Container object
-
- In Review
-
The Docker Build Step plugin is the closest match I can find to what you are talking about. (It does not sound like it currently allows docker exec commands, but I think that would be a natural addition.) If made to implement SimpleBuildStep (merely newer core dep) it could be used as is from Workflow.
Or there could be dedicated workflow steps (workflow-step-api dep) if that is more helpful; for example a block-scoped step could be defined which uses LauncherDecorator to wrap all nested commands in docker exec.
The Docker plugin should already work with Workflow, but yes it assumes that the image has a JRE and SSHD since it runs the slave agent inside the image, rather than assuming a separate slave.