jenkinsci / jenkinsci/docker-workflow-plugin

[JENKINS-59893] bat calls hang in Windows Docker container in declarative pipeline script

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

Description

Description

bat steps hang (endless spinning wheel in the jobs console output) even for simple Windows containers.

bat "echo test inside"

Troubleshooting & Additional info

powershell and all other commands tried so far work without issue. Even using powershell to wrap cmd.exe commands works fine. Example:

 

powershell "cmd /c echo test inside"

 

Running the image manually on the node host exhibits no issues. i.e. can run docker run -it microsoft/windowsservercore:ltsc2016 and happy use cmd and all other commands without issue.

Similarly we can attach to the container spun up by the Jenkins job while it's hung and execute the same echo command (or any other) without issue.

Others have not had this issue so it could be something specific in our setup, but I have not been able to pinpoint anything. https://github.com/jenkinsci/docker-workflow-plugin/pull/184#issuecomment-539213785

The job console output shows no errors and neither does the main Jenkins log under /log/all. No errors if any kind while the job is running / hung.


Setup

Jenkins node host: Windows Server 2016 (1607)

Docker image: microsoft/windowsservercore:ltsc2016

Happens regardless if docker {} or dockerfile {} syntax is used.

Specifically using declarative pipeline scripts. Have not tested other methods

pipeline {

agent {
docker {
image 'microsoft/windowsservercore:ltsc2016'
label 'windows'
}
}
stages {
stage('Example Build') {
steps{
bat "echo test inside"
}
}
}
}

---
Originally reported by stuck_tech, imported from: bat calls hang in Windows Docker container in declarative pipeline script


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

Raw content of original issue

Description

bat steps hang (endless spinning wheel in the jobs console output) even for simple Windows containers.



bat "echo test inside"


Troubleshooting & Additional info

powershell and all other commands tried so far work without issue. Even using powershell to wrap cmd.exe commands works fine. Example:

 



powershell "cmd /c echo test inside"


 

Running the image manually on the node host exhibits no issues. i.e. can run docker run -it microsoft/windowsservercore:ltsc2016 and happy use cmd and all other commands without issue.

Similarly we can attach to the container spun up by the Jenkins job while it's hung and execute the same echo command (or any other) without issue.

Others have not had this issue so it could be something specific in our setup, but I have not been able to pinpoint anything. https://github.com/jenkinsci/docker-workflow-plugin/pull/184#issuecomment-539213785

The job console output shows no errors and neither does the main Jenkins log under /log/all. No errors if any kind while the job is running / hung.


Setup

Jenkins node host: Windows Server 2016 (1607)

Docker image: microsoft/windowsservercore:ltsc2016

Happens regardless if docker {} or dockerfile {} syntax is used.

Specifically using declarative pipeline scripts. Have not tested other methods



pipeline {

agent {
docker {
image 'microsoft/windowsservercore:ltsc2016'
label 'windows'
}
}
stages {
stage('Example Build') {
steps{
bat "echo test inside"
}
}
}
}

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.