jenkinsci / jenkinsci/docker-workflow-plugin

[JENKINS-48042] Cannot give build-arg or environment variable to docker.build

Open
#535 1 comment 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

I have a Dockerfile like this:

ARG REGISTRY_URL=machine:5000

ARG PI_VERSION=0.4

FROM ${REGISTRY_URL}/java:${PI_VERSION}

I cannot set REGISTRY_URL, neither by build-arg nor environment variable.

In jenkinsfile:

def dockerImage = docker.build "${VAR_DOCKER.registry}${item.name}:${item.versionDocker}"

Even with withEnv, it does not recognize new variable.

---
Originally reported by antoinetran, imported from: Cannot give build-arg or environment variable to docker.build


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

Raw content of original issue

I have a Dockerfile like this:

ARG REGISTRY_URL=machine:5000
ARG PI_VERSION=0.4
FROM ${REGISTRY_URL}/java:${PI_VERSION}

I cannot set REGISTRY_URL, neither by build-arg nor environment variable.

In jenkinsfile:
def dockerImage = docker.build "${VAR_DOCKER.registry}${item.name}:${item.versionDocker}"
Even with withEnv, it does not recognize new variable.

  • environment: docker-ce-17.06.0

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.