jenkinsci / jenkinsci/docker-workflow-plugin

[JENKINS-63253] pipeline + docker + dir() causes: process apparently never started in ...

Abierto
#653 8 comentarios 0 reacciones 0 asignados Ver en GitHub
component:docker-workflow-plugin component:durable-task-plugin imported-jira-issue priority:minor resolution:unresolved
Lenguaje dominante
Java
Estrellas
527
Forks
422
Merge medio
10 min
PR fusionados (30 d)
1

Descripción

So there's this weird behavior when using the built-in dir() method with a pipeline, running on a docker container and it causes anything in the dir block to hang. Please note the example below, as it explains it better than I can describe it:

 

pipeline {

agent {
docker {
label '********'
image '**********'
registryUrl '************'
registryCredentialsId '*******'
args '--user root:root'
}
}
stages {
stage('dir-testing') {
stages {
stage('without dir') {
steps {
sh 'cd /opt && ls -l'
}
}
stage('with dir') {
steps {
dir('/opt') {
sh 'ls -l'
}
}
}
}
post {
always {
cleanWs()
}
}
}
}
}

And the result is:

Started by user **********

Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] node
Running on ************ in /var/jenkins/workspace/test-cwd-bug
[Pipeline] {
[Pipeline] withEnv
[Pipeline] {
[Pipeline] withDockerRegistry
Using the existing docker config file.Removing blacklisted property: auths$ docker login -u ******** -p ******** *********
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Login Succeeded
[Pipeline] {
[Pipeline] isUnix
[Pipeline] sh
+ docker inspect -f . **********

Error: No such object: ***********
[Pipeline] isUnix
[Pipeline] sh
+ docker inspect -f . ****************
.
[Pipeline] withDockerContainer
************* does not seem to be running inside a container
$ docker run -t -d -u 0:0 --user root:root -w /var/jenkins/workspace/test-cwd-bug -v /var/jenkins/workspace/test-cwd-bug:/var/jenkins/workspace/test-cwd-bug:rw,z -v /var/jenkins/workspace/test-cwd-bug@​tmp:/var/jenkins/workspace/test-cwd-bug@​tmp:rw,z -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** ********************* cat
$ docker top 969a08a99a24c314d5d80f2cbf77920db4e269524d1af6738c0ddc5417da3f16 -eo pid,comm
[Pipeline] {
[Pipeline] stage
[Pipeline] { (dir-testing)
[Pipeline] stage
[Pipeline] { (without dir)
[Pipeline] sh
+ cd /opt
+ ls -l
total 8
drwxr-xr-x 4 root root 4096 Jul 24 15:29 artifactory-scripts
drwxr-xr-x 1 608 500 4096 Jul 24 15:39 cv25_linux_sdk_2.5
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (with dir)
[Pipeline] dir
Running in /opt
[Pipeline] {
[Pipeline] sh
process apparently never started in /opt@​tmp/durable-5a20a76a
(running Jenkins temporarily with -Dorg.jenkinsci.plugins.durabletask.BourneShellScript.LAUNCH_DIAGNOSTICS=true might make the problem clearer)
[Pipeline] }
[Pipeline] // dir
[Pipeline] }
[Pipeline] // stage
Post stage
[Pipeline] cleanWs
[WS-CLEANUP] Deleting project workspace...
[WS-CLEANUP] Deferred wipeout is used...
[WS-CLEANUP] done
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
$ docker stop --time=1 969a08a99a24c314d5d80f2cbf77920db4e269524d1af6738c0ddc5417da3f16
$ docker rm -f 969a08a99a24c314d5d80f2cbf77920db4e269524d1af6738c0ddc5417da3f16
[Pipeline] // withDockerContainer
[Pipeline] }
[Pipeline] // withDockerRegistry
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code -2
Finished: FAILURE


 

---
Originally reported by smirky, imported from: pipeline + docker + dir() causes: process apparently never started in ...


  • assignee: wei948884609
  • status: Open
  • priority: Minor
  • component(s): docker-workflow-plugin, durable-task-plugin
  • resolution: Unresolved
  • votes: 7
  • watchers: 10
  • imported: 2025-12-07

Raw content of original issue

So there's this weird behavior when using the built-in dir() method with a pipeline, running on a docker container and it causes anything in the dir block to hang. Please note the example below, as it explains it better than I can describe it:

 



pipeline {

agent {
docker {
label '********'
image '**********'
registryUrl '************'
registryCredentialsId '*******'
args '--user root:root'
}
}
stages {
stage('dir-testing') {
stages {
stage('without dir') {
steps {
sh 'cd /opt && ls -l'
}
}
stage('with dir') {
steps {
dir('/opt') {
sh 'ls -l'
}
}
}
}
post {
always {
cleanWs()
}
}
}
}
}


And the result is:



Started by user **********

Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] node
Running on ************ in /var/jenkins/workspace/test-cwd-bug
[Pipeline] {
[Pipeline] withEnv
[Pipeline] {
[Pipeline] withDockerRegistry
Using the existing docker config file.Removing blacklisted property: auths$ docker login -u ******** -p ******** *********
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Login Succeeded
[Pipeline] {
[Pipeline] isUnix
[Pipeline] sh
+ docker inspect -f . **********

Error: No such object: ***********
[Pipeline] isUnix
[Pipeline] sh
+ docker inspect -f . ****************
.
[Pipeline] withDockerContainer
************* does not seem to be running inside a container
$ docker run -t -d -u 0:0 --user root:root -w /var/jenkins/workspace/test-cwd-bug -v /var/jenkins/workspace/test-cwd-bug:/var/jenkins/workspace/test-cwd-bug:rw,z -v /var/jenkins/workspace/test-cwd-bug@tmp:/var/jenkins/workspace/test-cwd-bug@tmp:rw,z -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** ********************* cat
$ docker top 969a08a99a24c314d5d80f2cbf77920db4e269524d1af6738c0ddc5417da3f16 -eo pid,comm
[Pipeline] {
[Pipeline] stage
[Pipeline] { (dir-testing)
[Pipeline] stage
[Pipeline] { (without dir)
[Pipeline] sh
+ cd /opt
+ ls -l
total 8
drwxr-xr-x 4 root root 4096 Jul 24 15:29 artifactory-scripts
drwxr-xr-x 1 608 500 4096 Jul 24 15:39 cv25_linux_sdk_2.5
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (with dir)
[Pipeline] dir
Running in /opt
[Pipeline] {
[Pipeline] sh
process apparently never started in /opt@tmp/durable-5a20a76a
(running Jenkins temporarily with -Dorg.jenkinsci.plugins.durabletask.BourneShellScript.LAUNCH_DIAGNOSTICS=true might make the problem clearer)
[Pipeline] }
[Pipeline] // dir
[Pipeline] }
[Pipeline] // stage
Post stage
[Pipeline] cleanWs
[WS-CLEANUP] Deleting project workspace...
[WS-CLEANUP] Deferred wipeout is used...
[WS-CLEANUP] done
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
$ docker stop --time=1 969a08a99a24c314d5d80f2cbf77920db4e269524d1af6738c0ddc5417da3f16
$ docker rm -f 969a08a99a24c314d5d80f2cbf77920db4e269524d1af6738c0ddc5417da3f16
[Pipeline] // withDockerContainer
[Pipeline] }
[Pipeline] // withDockerRegistry
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code -2
Finished: FAILURE



 

environment

```
OS Jenkins Master/Slave: Ubuntu x64 16.04

Jenkins server version: 2.235.2

durable task plugin version: 1.34

all other plugins: latest version (for 2020-07-29)
```

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.