真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

查看私有倉(cāng)庫(kù)鏡像python腳本

1.在python官網(wǎng)下載python解釋器

[https://www.python.org/ftp/python/3.6.7/Python-3.6.7.tgz]

創(chuàng)新互聯(lián)堅(jiān)持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:成都網(wǎng)站制作、網(wǎng)站設(shè)計(jì)、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時(shí)代的麗江網(wǎng)站設(shè)計(jì)、移動(dòng)媒體設(shè)計(jì)的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!

2.解包進(jìn)入同名目錄編譯安裝

[root@localhost python]#./configure --prefix=/usr/local/python3

3.將python3程序設(shè)置軟連接

[root@localhost ~]# ln -s /usr/local/python3/bin/python3 /usr/bin/python3

4.創(chuàng)建虛擬環(huán)境并激活

[root@localhost ~]# mkdir python python3 -m venv ~/python
[root@localhost ~]# source python/bin/activate

5.執(zhí)行腳本查看鏡像

(python) [root@localhost ~]# cat get_images.py

#!/usr/bin/env python
import requests  
import json  
import traceback  
repo_ip = '1.1.1.1'  
repo_port = 5000  
def getImagesNames(repo_ip,repo_port):  
    docker_images = []  
    try:  
        url = "http://" + repo_ip + ":" +str(repo_port) + "/v2/_catalog"  
        res =requests.get(url).content.strip()  
        res_dic = json.loads(res)  
        images_type = res_dic['repositories']  
        for i in images_type:  
            url2 = "http://" + repo_ip + ":" +str(repo_port) +"/v2/" + str(i) + "/tags/list"  
            res2 =requests.get(url2).content.strip()  
            res_dic2 = json.loads(res2)  
            name = res_dic2['name']  
            tags = res_dic2['tags']  
            for tag in tags:  
                docker_name = str(repo_ip) + ":" + str(repo_port) + "/" + name + ":" + tag  
                docker_images.append(docker_name)  
                print (docker_name) 
    except:  
        traceback.print_exc()  
    return docker_images  
a=getImagesNames(repo_ip, repo_port)
最終效果
(python) [root@localhost ~]# python get_images.py 
1.1.1.1:5000/anmi_web:1.0.2
1.1.1.1:5000/anmi_web:1.0.3
1.1.1.1:5000/redis:1.0.2
1.1.1.1:5000/duyanbase:1.0
1.1.1.1:5000/duyanbase:latest

網(wǎng)站欄目:查看私有倉(cāng)庫(kù)鏡像python腳本
文章分享:http://weahome.cn/article/jdpdsj.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部