jenkinsci / jenkinsci/docker-workflow-plugin
[JENKINS-63151] Execute steps before starting docker container
- 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
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
Assessment
This issue has not been assessed yet.