jenkinsci / jenkinsci/docker-workflow-plugin

[JENKINS-53866] Image.tag should accept repository name

Open
#586 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

Image.tag should accept repository names. Currently tag relies on the repository provided in the build command. Attempting to retag an image prefixes the repository from the build, with no way of overriding the original value.

 

Via the command line one can execute the following commands successfully

docker build -t A

docker tag A B/C:A
docker push B/C:A

 

However the analogous commands in jenkins produce a failure

docker.build('A')

image = docker.image('A')
image.tag('B/C:A')

 

In this example image.tag produces the output

docker tag A A:B/C:A

Error parsing reference: "A:B/C:A" is not a valid repository/tag: invalid reference format

 

It's possible to execute the command successfully using a sh command in the pipeline, though at that point image.push does not pick up the tag and the push command must be executed via sh as well.

 

Docker image functionality in the Jenkins Pipeline should replicate the behavior found in the underlying docker utility.

---
Originally reported by psenet, imported from: Image.tag should accept repository name


  • assignee: allan_burdajewicz
  • status: In Review
  • priority: Minor
  • component(s): docker-workflow-plugin
  • resolution: Unresolved
  • votes: 4
  • watchers: 3
  • imported: 2025-12-07

Raw content of original issue

Image.tag should accept repository names. Currently tag relies on the repository provided in the build command. Attempting to retag an image prefixes the repository from the build, with no way of overriding the original value.

 

Via the command line one can execute the following commands successfully



docker build -t A

docker tag A B/C:A
docker push B/C:A


 

However the analogous commands in jenkins produce a failure



docker.build('A')

image = docker.image('A')
image.tag('B/C:A')


 

In this example image.tag produces the output



docker tag A A:B/C:A

Error parsing reference: "A:B/C:A" is not a valid repository/tag: invalid reference format


 

It's possible to execute the command successfully using a sh command in the pipeline, though at that point image.push does not pick up the tag and the push command must be executed via sh as well.

 

Docker image functionality in the Jenkins Pipeline should replicate the behavior found in the underlying docker utility.

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.