I am trying to push my image that have been built in the pipeline to the Docker registry and I have two tags on my image (latest and commit hash), but when using the command docker push --all-tags registry.gitlab.com/group/image-name, it does not work and I get this error:
unknown flag: --all-tags
I am using docker with the latest version and GitLab CI/CD stage definition is like this
Build Docker Image:
stage: Build Docker Image
image: docker:stable
needs: ["Build & Test App"]
services:
- docker:dind
script:
- echo "$CI_REGISTRY_PASSWORD" | docker login "$CI_REGISTRY" -u "$CI_REGISTRY_USER" --password-stdin
- docker build -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA" .
- docker tag "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA" "$CI_REGISTRY_IMAGE:latest"
- docker push --all-tags "$CI_REGISTRY_IMAGE"
When I tried it on my local machine, it seems like this flag is known and it works. Do you know, what could be the issue? Thanks a lot.