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 has impacted a small number of users who are using Bitbucket Pipelines. Some pipeline may fail when pushing Docker images from pipelines, with errors similar to the below
<span>docker push ${IMAGE_NAME}
</span>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 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 the docker push command to push all available tags. Such as:
<span>docker push --all-tags IMAGE_NAME</span>
or
<span>docker push -a IMAGE_NAME</span>
-
Specify the tag to be pushed, such as:
<span>docker push IMAGE_NAME:TAG</span>
-
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:
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