jenkinsci / jenkinsci/docker-workflow-plugin

[JENKINS-63438] Pipeline docker.build - docker build-arg cause pipeline to fail

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

Description

Both of these attempts results in the error 

 "docker build" requires exactly 1 argument.

I believe this to be a bug since the docker.build works fine without any arguments.

stage('Build image') {

steps{
sh """docker build -t my-image:dev --build-arg VAULT_TOKEN=${VAULT_TOKEN} ."""
}
}

 

stage('Build image') { 

steps{
docker.build "my-image:dev", "--build-arg VAULT_TOKEN=${VAULT_TOKEN} ."
}
}

When looking at the pipeline output I can see the trailing "." is being removed from the docker.build step

+ docker build -t my-image:dev --build-arg VAULT_TOKEN=

"docker build" requires exactly 1 argument.
See 'docker build --help'.

Usage: docker build [OPTIONS] PATH | URL | -

---
Originally reported by gene_gaddy, imported from: Pipeline docker.build - docker build-arg cause pipeline to fail


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

Raw content of original issue

Both of these attempts results in the error 
 "docker build" requires exactly 1 argument.

I believe this to be a bug since the docker.build works fine without any arguments.



stage('Build image') {

steps{
sh """docker build -t my-image:dev --build-arg VAULT_TOKEN=${VAULT_TOKEN} ."""
}
}


 



stage('Build image') { 

steps{
docker.build "my-image:dev", "--build-arg VAULT_TOKEN=${VAULT_TOKEN} ."
}
}


When looking at the pipeline output I can see the trailing "." is being removed from the docker.build step



+ docker build -t my-image:dev --build-arg VAULT_TOKEN=<token>

"docker build" requires exactly 1 argument.
See 'docker build --help'.

Usage: docker build [OPTIONS] PATH | URL | -


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.