Docker push failing — tag does not exist
Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.
Summary
As part of the planned Docker Client upgrade, docker cli is upgraded from v19.03.15 to v20.10.15.
Unfortunately, this upgrade introduced some breaking changes which have impacted a small number of users who are using Bitbucket Pipelines. Some pipelines may fail when pushing Docker images from pipelines, with errors similar to the below
1
2
3
4
docker push ${IMAGE_NAME}
Using default tag: latest
The push refers to repository [<repository>]
tag does not exist: <repository>:latest
Cause
In June 2022, Bitbucket Pipelines upgraded to Docker CLI version v20.10.15. Prior to Docker CLI version 20, the docker push
command would push all available image tags if no tag was specified. For version 20, the Docker CLI updated the docker push
command to try to push the latest
tag, if a tag is not specified. If the latest
tag does not exist, the command will fail. For more details please refer here.
Solution
To resolve the issue, update the docker push
command in the pipeline to either:
Add the
--all-tags
(or-a
) option to thedocker push
command to push all available tags. Such as:1
docker push --all-tags IMAGE_NAME
or
1
docker push -a IMAGE_NAME
Specify the tag to be pushed, such as:
1
docker push IMAGE_NAME:TAG
Manually install the docker v19.03.15 client (see below).
Downgrading or using an alternative client
To downgrade or use an alternative Docker client, you can install it manually, and place it at the beginning of the $PATH variable.
For example to download v19.03.15:
1
2
3
4
5
6
7
8
9
10
11
12
pipelines:
default:
- step:
services:
- docker
script:
- curl -s -O https://download.docker.com/linux/static/stable/x86_64/docker-19.03.15.tgz
- tar --extract --file=docker-19.03.15.tgz
- ls -al ./docker
- export PATH=./docker:$PATH
- which docker
- docker version
Was this helpful?