jenkinsci / jenkinsci/docker-workflow-plugin

[JENKINS-50857] Docker agent on windows fails with Cannot run program "id"

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

Description

I'm trying to use a docker agent on windows in declarative pipeline. I can see the image is pulled but then fails as below

[ply-widgets-project-pipelin-GORWBIPVPM5EWBJECA7BVJBSR5OVNCYISONJIELJYMXAG4YTMWPQ] Running shell script

sh: sleep: command not found
sh: sleep: command not found
sh: sleep: command not found
sh: sleep: command not found
sh: sleep: command not found
+ docker inspect -f . 1234567.dkr.ecr.us-west-2.amazonaws.com/builds/jenkins-agent-node:windows-npm-5.8.0
.
Cannot run program "id": CreateProcess error=2, The system cannot find the file specified

 

I'm using the following in my jenkinsfile for a stage

agent {

docker {
image '1234567.dkr.ecr.us-west-2.amazonaws.com/builds/jenkins-agent-node:windows-npm-5.8.0'
label 'windows&&docker'
}
}

While I don't think it matters in this case my registry is actually AWS ECR and the agent is a windows server 2016, in a previous stage the following is run to login to ECR

powershell 'Get-ECRLoginCommand -region us-west-2 | select -ExpandProperty command | Invoke-Expression'

---
Originally reported by jonathank, imported from: Docker agent on windows fails with Cannot run program "id"


  • status: Open
  • priority: Critical
  • component(s): docker-workflow-plugin
  • label(s): declarative, docker, pipeline
  • resolution: Unresolved
  • votes: 3
  • watchers: 5
  • imported: 2025-12-07

Raw content of original issue

I'm trying to use a docker agent on windows in declarative pipeline. I can see the image is pulled but then fails as below



[ply-widgets-project-pipelin-GORWBIPVPM5EWBJECA7BVJBSR5OVNCYISONJIELJYMXAG4YTMWPQ] Running shell script

sh: sleep: command not found
sh: sleep: command not found
sh: sleep: command not found
sh: sleep: command not found
sh: sleep: command not found
+ docker inspect -f . 1234567.dkr.ecr.us-west-2.amazonaws.com/builds/jenkins-agent-node:windows-npm-5.8.0
.
Cannot run program "id": CreateProcess error=2, The system cannot find the file specified


 

I'm using the following in my jenkinsfile for a stage



agent {

docker {
image '1234567.dkr.ecr.us-west-2.amazonaws.com/builds/jenkins-agent-node:windows-npm-5.8.0'
label 'windows&&docker'
}
}


While I don't think it matters in this case my registry is actually AWS ECR and the agent is a windows server 2016, in a previous stage the following is run to login to ECR



powershell 'Get-ECRLoginCommand -region us-west-2 | select -ExpandProperty command | Invoke-Expression'


environment

```
Windows Server Core 2016

Jenkins 2.89.4

Pipeline: Declarative 1.2.8
```

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.