jenkinsci / jenkinsci/docker-workflow-plugin

[JENKINS-63151] Execute steps before starting docker container

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

Description

Execute steps on the host, after selecting the proper node, and before starting the docker container.

Minimal code examples (see the added pre directive):

pipeline {

agent {
docker {
image 'maven:3-alpine'
pre {
echo 'Called from the host (outside the container).'
}
}
}
stages {
stage('Build') {
steps {
echo 'Called from inside the container.'
}
}
}
}

pipeline {

agent none
stages {
stage('Build') {
agent {
docker {
image 'maven:3-alpine'
pre {
echo 'Called from the host (outside the container).'
}
}
}
steps {
echo 'Called from inside the container.'
}
}
}
}

The steps inside pre should be executed prior to executing the first stage/step.

An alternative name is preRun.

 

---
Originally reported by 95jonpet, imported from: Execute steps before starting docker container


  • status: Open
  • priority: Minor
  • component(s): docker-workflow-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 1
  • imported: 2025-12-07

Raw content of original issue

Execute steps on the host, after selecting the proper node, and before starting the docker container.

Minimal code examples (see the added pre directive):



pipeline {

agent {
docker {
image 'maven:3-alpine'
pre {
echo 'Called from the host (outside the container).'
}
}
}
stages {
stage('Build') {
steps {
echo 'Called from inside the container.'
}
}
}
}



pipeline {

agent none
stages {
stage('Build') {
agent {
docker {
image 'maven:3-alpine'
pre {
echo 'Called from the host (outside the container).'
}
}
}
steps {
echo 'Called from inside the container.'
}
}
}
}


The steps inside pre should be executed prior to executing the first stage/step.

An alternative name is preRun.

 

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.