registry

镜像同步脚本,该脚本只实现了把仓库中的镜像全部拉去到本地.

import json
import os
url='127.0.0.1:5000'

cmd1="curl -s http://url/v2/_catalog"
cmd2="curl -s http://url/v2/%s/tags/list"
cmd3="docker pull %s"

a=os.popen(cmd1)
b=json.load(a)
for registry in b['repositories']:
  _temp=os.popen(cmd2%registry)
  _temp=json.load(_temp)
  for tag in _temp['tags']:
    image="nosql.registry.io:5000/%s:%s"%(registry,tag)
   # print(image)
    os.system(cmd3%image)
posted @ 2023-04-26 14:41  mingtian是吧  阅读(66)  评论(0编辑  收藏  举报