自動化kolla-ansible部署ubuntu20.04+openstack-victoria之本地倉庫-06


自動化kolla-ansible部署ubuntu20.04+openstack-victoria之本地倉庫-06


歡迎加QQ群:1026880196 進行討論

 

1. 安裝docker registry 私有倉庫

docker run -d -p 4000:5000 -v /opt/registry/:/var/lib/registry/ --restart=always --name registry registry:latest

 

2. 查看私有倉庫

curl -XGET http://xxx.baijingcloud.com:4000/v2/_catalog


3. 編輯腳本文件pull docker鏡像

#提前下載 https://github.com/openstack/kolla-ansible/tree/stable/victoria  zip 軟件包 到root目錄

vim kolla_victoria_image.sh

#!/bin/bash 
#auth:
#date....


#git clone https://github.com/openstack/kolla.git
#rm -rf /root/kolla.txt
abspath=/root/kolla-stable-victoria
image_file=/root/victoria.txt
result_file=/root/result.txt
first_index=($(ls -l $abspath/docker | grep "^d" | awk '{print $NF}'))

kolla_base_distro=centos
kolla_install_type=source
openstack_release=victoria
namespace=kolla


rm -rf $image_file $result_file

function get_kolla_image(){
for first_file in ${first_index[@]}
do 
#echo $first_file 
second_files=($(ls -l $abspath/docker/$first_file | grep "^d" | awk '{print $NF}'))
if [ ${#second_files[@]} -eq 0 ] then echo $first_file >> $image_file else for second_file in ${second_files[@]} do echo $second_file >> $image_file done fi done } function make_registry(){ /usr/bin/docker run -d -p 4000:5000 -v /opt/registry/:/var/lib/registry --restart=always --name=reigstry registry:latest images=($(cat $image_file)) for image in ${images[@]} do docker pull $namespace/$kolla_base_distro-$kolla_install_type-$image:$openstack_release if [ $? -eq 0 ] then docker tag $namespace/$kolla_base_distro-$kolla_install_type-$image:$openstack_release xxx.baijingcloud.com:4000/kolla/$kolla_base_distro-$kolla_install_type-$image:$openstack_release docker push xxx.baijingcloud.com:4000/kolla/$kolla_base_distro-$kolla_install_type-$image:$openstack_release echo "$namespace/$kolla_base_distro-$kolla_install_type-$image push success!" >> $result_file else echo "Docker Hub have not $namespace/$kolla_base_distro-$kolla_install_type-$image" >> $result_file fi done } get_kolla_image make_registry

 

4. 執行腳本文件pull docker鏡像

sudo dpkg-reconfigure dash    #彈出的窗口選擇no         (#歡迎加QQ群:1026880196 進行交流學習)
chmod +x kolla_victoria_image.sh sh kolla_victoria_image.sh

 

5. 查看私有倉庫

curl -XGET http://xxx.baijingcloud.com:4000/v2/_catalog


6. 也可以查看文件目錄

ls /opt/registry/docker/registry/v2/repositories/kolla/

 

 

 

 


 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM