我希望将 docker 镜像从第三方注册表复制到谷歌云的 Artifactory 注册表,因为谷歌不支持第三方私有(private)注册表。在这里Docs
我设法从神器(第三方)中提取图像,然后将其推送到谷歌云的神器注册表。
有没有更好的方法?
最佳答案
Google Artifactory 注册表文档有一个关于 migrating artifacts from a third-party registry 的页面。 .
在其中,他们建议使用 gcrane
是 google 开发的 crane
命令行实用程序的扩展,用于管理容器,并具有特定于 gcr.io
的扩展。
The gcrane tool helps you with the copying process.
Create a text file
images.txt
in Cloud Shell with the names of the images you identified. For example:ubuntu:18.04 debian:buster hello-world:latest redis:buster jupyter/tensorflow-notebook
Download gcrane.
github.com/google/go-containerregistry/cmd/gcrane
Create a script named copy_images.sh to copy your list of files.
#!/bin/bash images=$(cat images.txt) if [ -z "${AR_PROJECT}" ] then echo ERROR: AR_PROJECT must be set before running this exit 1 fi for img in ${images} do gcrane cp ${img} LOCATION-docker.pkg.dev/${AR_PROJECT}/${img} done
Replace
LOCATION
with theregion
ormulti-region
of your repository.Make the script executable:
chmod +x copy_images.sh
Run the script to copy the files:
AR_PROJECT=${PROJECT} ./copy_images.sh
这些文档提供了有关识别工作流程中所需的图像、验证权限以及更新 list 、成本等的额外指导。
关于docker - 如何将 docker 镜像从私有(private)第三方注册表迁移到 Google Artifactory 注册表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72310120/