jenkinsci / jenkinsci/docker-workflow-plugin

[JENKINS-48795] docker.build fails for Dockerfile which uses ARG in FROM

Open
#544 2 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

Dockerfiles are allowed to have ARG directives before the FROM directive, in which case the value for FROM can reference build arguments:

ARG TAG

FROM alpine:$TAG

Using docker.build('foo', '--build-arg TAG=3.7 .') in scripted pipeline on such a Dockerfile fails with:

java.io.IOException: Cannot retrieve .Id from 'docker inspectalpine:$TAG'

---
Originally reported by jovrum, imported from: docker.build fails for Dockerfile which uses ARG in FROM


  • status: Open
  • priority: Minor
  • component(s): docker-workflow-plugin
  • resolution: Unresolved
  • votes: 1
  • watchers: 3
  • imported: 2025-12-07

Raw content of original issue

Dockerfiles are allowed to have ARG directives before the FROM directive, in which case the value for FROM can reference build arguments:

ARG TAG
FROM alpine:$TAG

Using docker.build('foo', '--build-arg TAG=3.7 .') in scripted pipeline on such a Dockerfile fails with:

java.io.IOException: Cannot retrieve .Id from 'docker inspectalpine:$TAG'

environment

```
Jenkins 2.99

Plugins:

Docker Pipeline 1.14

Docker Commons 1.10
```

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.