如何在远程注册表中重命名docker映像

问题描述 投票:5回答:1

我的远程Docker注册表中有一个图像:

xx.xx.xx.xx:5000/library/ruby:2.2.1

是否有快速的方法或现有命令对其进行重命名?

[我知道我可以通过在本地执行docker pull并将其重命名为docker tag,然后再命名为docker push来实现。

docker pull xx.xx.xx.xx:5000/library/ruby:2.2.1
docker tag xx.xx.xx.xx:5000/library/ruby:2.2.1  xx.xx.xx:5000/library/new_name:latest
docker push xx.xx.xx.xx:5000/library/new_name:latest

但是由于拉入和推入图像会花费时间,所以我想知道是否有一种快速的方式来对其重命名吗?

docker docker-registry
1个回答
0
投票
a)如果您只想更改

TAG:答案https://stackoverflow.com/a/38362476/8430173仅适用于更改TAGb)如果您也想更改存储库名称:

非常感谢this,我也更改了repoName!((通过他的Github项目帮助:

1-获取清单(在v2模式中)2-在新仓库中发布每个图层。摘要3-发布配置层4-将整个清单放入新的回购中

详细信息:

1-GET

reg:5000/v2/{oldRepo}/manifests/{oldtag}带有accept标头的清单:application/vnd.docker.distribution.manifest.v2+json每层

2-

POST

reg:5000/v2/{newRepo}/blobs/uploads/?mount={layer.digest}&from={oldRepoNameWithaoutTag}3- POST reg:5000/v2/{newRepo}/blobs/uploads/?mount={config.digest}&from={oldRepoNameWithaoutTag}

<< [4- PUT

具有reg:5000/v2/{newRepo}/manifests/{newTag}标头的content-type:来自步骤1响应的application/vnd.docker.distribution.manifest.v2+jsonbody

5-

享受!
© www.soinside.com 2019 - 2024. All rights reserved.