#!/bin/bash

DOCKER_REGISTRY="your.docker.registry.com" DOCKER_NAMESPACE="your-namespace" DOCKER_USERNAME="your-username" DOCKER_PASSWORD="your-password"

docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD" "$DOCKER_REGISTRY"

获取所有docker镜像的id

images=$(docker images --format "{{.Repository}}:{{.Tag}}")

导入镜像到私有仓库

for image in $images do docker tag $image "$DOCKER_REGISTRY/$DOCKER_NAMESPACE/$image" docker push "$DOCKER_REGISTRY/$DOCKER_NAMESPACE/$image" done

echo "All images have been imported to your private registry."

写一个可以将docker镜像全部导入私有镜像仓库的shell脚本

原文地址: https://www.cveoy.top/t/topic/baAY 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录