镜像同步脚本,该脚本只实现了把仓库中的镜像全部拉去到本地.
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)
标签:temp,url,image,json,registry,os
From: https://www.cnblogs.com/wangend/p/17356041.html