Docker Push --all-tags 在管道中不起作用

标签 docker gitlab gitlab-ci

我正在尝试将管道中构建的镜像推送到 Docker 注册表,并且镜像上有两个标签( latestcommit hash ),但是当使用命令 docker push --all-tags registry.gitlab.com/group/image-name 时,它不起作用,我收到此错误:

unknown flag: --all-tags

我使用的是最新版本的 docker,GitLab CI/CD 阶段定义是这样的

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"

当我在本地计算机上尝试时,似乎这个标志是已知的并且它可以工作。你知道,可能是什么问题吗?非常感谢。

最佳答案

要使用--all-tags,请使用docker:latest镜像

关于Docker Push --all-tags 在管道中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68781212/

相关文章:

gitlab - 生成在两个标签之间合并的所有合并请求的列表,所有信息都在 csv 文件中

azure - 如何集成带有Azure Kubernetes + Kubectl + ACR的GitLab-Ci进行部署?

Gitlab .gitlab-ci.yml 文件在分支中不同

docker 使用 github 帐户登录到 gitlab 注册表

.net-core - GitLab 包注册表 每个组的 Nuget 包

java - gitlab ci : mysql build and restore db dump

docker - 容器因 : "httpd: Could not open configuration file/etc/httpd/conf/httpd.conf: No such file or directory", 停止,为什么?

node.js - "Error: spawn mongoexport ENOENT"运行 dockerized Node 应用程序时

docker - "docker rmi"至少需要 1 个参数

node.js - 如何使用 google/node-runtime 镜像在 Docker 中运行 Ghost?