jenkinsci / jenkinsci/docker-workflow-plugin

[JENKINS-31225] docker.build fails with if HOME is not set.

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

Description

I had a node with docker installed - yet docker workflow was failing with

```
/scratch/jenkins/workspace/myjob/.954d8efa/script.sh: line 2: docker: command not found

```

yet docker was available on this node and in the path (as verified by sh 'which docker;docker version'

It transpired that docker-workflow was spinning up another node unescearily and this node did not have docker installed - hence the failure.

After some discussion with jglick we found that the node with docker on did not set the HOME environment variable.

The workaround was to wrap the docker commands with withEnv(['HOME='+pwd()]).

The plugin should explicitly state why it is spawing a new node - to help the user understand, and should probably not rely on the HOME environment variable being set to determine if it can use docker

---
Originally reported by teilo, imported from: docker.build fails with if HOME is not set.


  • assignee: jglick
  • status: Reopened
  • priority: Blocker
  • component(s): docker-workflow-plugin
  • resolution: Unresolved
  • votes: 3
  • watchers: 6
  • imported: 2025-12-07

Raw content of original issue

I had a node with docker installed - yet docker workflow was failing with


/scratch/jenkins/workspace/myjob/.954d8efa/script.sh: line 2: docker: command not found


yet docker was available on this node and in the path (as verified by sh 'which docker;docker version'

It transpired that docker-workflow was spinning up another node unescearily and this node did not have docker installed - hence the failure.

After some discussion with jglick we found that the node with docker on did not set the HOME environment variable.

The workaround was to wrap the docker commands with withEnv(['HOME='+pwd()]).

The plugin should explicitly state why it is spawing a new node - to help the user understand, and should probably not rely on the HOME environment variable being set to determine if it can use docker

environment

```
CloudBees Docker Workflow 1.2

Workflow 1.10.1

Jenkins 1.609.1

arch linux
```

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.