中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當前位置: 首頁 > news >正文

網(wǎng)站域名備案在哪里職業(yè)培訓(xùn)機構(gòu)需要什么資質(zhì)

網(wǎng)站域名備案在哪里,職業(yè)培訓(xùn)機構(gòu)需要什么資質(zhì),企業(yè)門戶網(wǎng)站云服務(wù)器配置要求,推銷商務(wù)網(wǎng)站的途徑有哪些目錄 注意: 腳本內(nèi)容 執(zhí)行效果 注意: 以下腳本為shell腳本通過docker/nerdctl進行鏡像獨立打包鏡像的相關(guān)操作腳本內(nèi)倉庫信息和鏡像存取路徑需自行更改需自行創(chuàng)建images.txt并填寫值,并且與腳本位于同級目錄下 [rootmaster01 sulibao]# l…

目錄

注意:

腳本內(nèi)容

執(zhí)行效果


注意:

  • 以下腳本為shell腳本通過docker/nerdctl進行鏡像獨立打包鏡像的相關(guān)操作
  • 腳本內(nèi)倉庫信息和鏡像存取路徑需自行更改
  • 需自行創(chuàng)建images.txt并填寫值,并且與腳本位于同級目錄下
    [root@master01 sulibao]# ll
    -rw-r--r-- 1 root root 3621 Feb 17 15:32 images_pull_save_load_tag_push.sh
    -rw-r--r-- 1 root root  906 Feb 17 15:11 images.txt
  • 該腳本讀入單個選項和多個選項,多個選項以英文模式","相隔
  • 該腳本不關(guān)系定時任務(wù),使用交互顯示輸出信息,需要保留日志可自行添加定向

腳本內(nèi)容

#!/bin/bash#定義原鏡像倉庫地址、login用戶、login密碼
registry_host="xxx"
registry_username="xxx"
registry_password="xxx"#定義鏡像列表文件,此文件應(yīng)和腳本位于同級目錄下
IMAGE_LIST_FILE="images.txt"#定義鏡像存取目錄
SAVE_DIR=/data/sulibao/images_$(date +"%Y-%m-%d")#定義push的鏡像倉庫地址、login用戶、login密碼
des_registry_host="192.168.2.190:5000"
des_registry_username="xxx"
des_registry_password="xxx"#環(huán)境準備,登錄原鏡像倉庫,確認鏡像列表文件存在
prepare_environment() {mkdir -p "$SAVE_DIR"local login_output=$(docker login "$registry_host" -u "$registry_username" -p "$registry_password" 2>&1)if [ $? != 0 ]; thenecho "Login error: $login_output"echo "exit!!!"return 1fiif [ ! -f "$IMAGE_LIST_FILE" ]; thenecho "指定的鏡像列表文件 $IMAGE_LIST_FILE 不存在,請檢查文件和權(quán)限!"exit 1elif [ ! -s "$IMAGE_LIST_FILE" ]; thenecho "指定的鏡像列表文件 $IMAGE_LIST_FILE 為空,請確保文件包含有效的鏡像列表信息!"exit 1fireturn 0
}#拉取鏡像
pull_images() {echo "開始拉取鏡像!"while IFS= read -r image; doif [[ ! -z "$image" ]]; thenecho "Pulling image: $image"docker pull "$image"if [ $? != 0 ]; thenecho "拉取鏡像 $image 失敗!"fifidone < "$IMAGE_LIST_FILE"echo "鏡像拉取完成!"
}#保存鏡像
save_images() {echo "開始保存鏡像!"while IFS= read -r image; doif [[ ! -z "$image" ]]; thenlocal image_file=$(echo "$image" | tr '/:' '_')echo "Saving image: $image to $SAVE_DIR/$image_file.tar"docker save -o "$SAVE_DIR/$image_file.tar" "$image"if [ $? != 0 ]; thenecho "保存鏡像 $image 失敗!"fi#docker rmi "$image"   #此處涉及有一個鏡像遍歷刪除,在保存鏡像包后刪除鏡像,如需要請自行開啟fidone < "$IMAGE_LIST_FILE"echo "鏡像保存完成!"
}#導(dǎo)入鏡像
load_images() {if [ -z "$(find "$SAVE_DIR" -mindepth 1 -print -quit)" ]; thenecho "鏡像存取目錄 $SAVE_DIR 中未發(fā)現(xiàn)鏡像文件,請檢查路徑!"exit 1filocal des_login_output=$(docker login $des_registry_host -u $des_registry_username -p $des_registry_password 2>&1)if [ $? != 0 ]; thenecho "Login error: $des_login_output"echo "exit!!!"exit 1fiecho "開始導(dǎo)入鏡像!"for image_file in "$SAVE_DIR"/*.tar; doif [ -f "$image_file" ]; thenecho "正在導(dǎo)入鏡像 $image_file"docker load -i "$image_file"if [ $? -ne 0 ]; thenecho "導(dǎo)入鏡像 $image_file 失敗!"fifidoneecho "所有 .tar 鏡像導(dǎo)入完成!"     
}#替換tag并推送到目標鏡像倉庫
tag_and_push_images() {echo "開始批量修改鏡像標簽并推送!"while IFS= read -r image; doif [ -n "$image" ]; thenimage_suffix="${image#*/}"new_image="${des_registry_host}/${image_suffix}"echo "正在為 $image 添加新標簽 $new_image"docker tag "$image" "$new_image"if [ $? -ne 0 ]; thenecho "為 $image 添加新標簽 $new_image 失敗!"continuefiecho "正在推送新鏡像 $new_image"docker push $new_imageif [ $? -ne 0 ]; thenecho "推送新鏡像 $new_image 失敗!"fidocker rmi $new_imagefidone < "$IMAGE_LIST_FILE"
}#操作選項
show_menu() {echo "Select the action you want to perform:"echo "1.Pull images."echo "2.Save images to $SAVE_DIR"echo "3.Load images from $SAVE_DIR"echo "4.Replace tag for images and push to target registry"echo "5.Exit."read -p "Please enter the operation number:" choiceIFS=',' read -ra choices <<< "$choice"for choice in "${choices[@]}"; docase $choice in1)pull_images;;2)save_images ;;3)load_images;;4)tag_and_push_images;;5)  echo "You have exited the program."exit 0;; *)echo "Invalid input, please enter option number."show_menu;;esacdone
}prepare_environment
show_menu

執(zhí)行效果

  • 完整執(zhí)行過程
[root@master01 sulibao]# bash images_pull_save_load_tag_push.sh 
Select the action you want to perform:
1.Pull images.
2.Save images to /data/sulibao/images_2025-02-17
3.Load images from /data/sulibao/images_2025-02-17
4.Replace tag for images and push to target registry
5.Exit.
Please enter the operation number:1,2,3,4開始拉取鏡像!
Pulling image: xxx/nginx:1.26.3
1.26.3: Pulling from xxx/nginx
Digest: sha256:52892d0d4f284526aa1d72ac42fd194c3e887580f60080ded2686d49037c6941
Status: Image is up to date for xxx/nginx:1.26.3
xxx/nginx:1.26.3
......
鏡像拉取完成!開始保存鏡像!
Saving image: xxx/nginx:1.26.3 to /data/sulibao/images_2025-02-17/xxx_nginx_1.26.3.tar
......
鏡像保存完成!開始導(dǎo)入鏡像!
正在導(dǎo)入鏡像 /data/sulibao/images_2025-02-17/xxx_nginx_1.26.3.tar
Loaded image: xxx/nginx:1.26.3
......
所有 .tar 鏡像導(dǎo)入完成!開始批量修改鏡像標簽并推送!
正在為 xxx/nginx:1.26.3 添加新標簽 192.168.2.190:5000/su03/nginx:1.26.3
正在推送新鏡像 192.168.2.190:5000/su03/nginx:1.26.3
The push refers to repository [192.168.2.190:5000/su03/nginx]
d9c572c95560: Layer already exists 
8190a7b44dae: Layer already exists 
a676f50129b7: Layer already exists 
867f455c499d: Layer already exists 
043f2436492e: Layer already exists 
263be8d15880: Layer already exists 
7914c8f600f5: Layer already exists 
1.26.3: digest: sha256:ed94607a3100cd7274aa915678f8e6d1effba2919198044654000383d77035ac size: 1778
Untagged: 192.168.2.190:5000/su03/nginx:1.26.3
Untagged: 192.168.2.190:5000/su03/nginx@sha256:ed94607a3100cd7274aa915678f8e6d1effba2919198044654000383d77035ac[root@master01 sulibao]# ll images_2025-02-17/
total 1290584
-rw------- 1 root root 781347328 Feb 17 16:35 xxx_mysql_8.0.41.tar
-rw------- 1 root root 196080128 Feb 17 16:35 xxx_nginx_1.26.3.tar
-rw------- 1 root root 344122368 Feb 17 16:35 xxx_postgresql_13.16.0.tar
  • 若鏡像列表文件不存在或為空
[root@master01 sulibao]# bash images_pull_save_load_tag_push.sh 
指定的鏡像列表文件 images.txt 不存在,請檢查文件和權(quán)限![root@master01 sulibao]# bash images_pull_save_load_tag_push.sh 
指定的鏡像列表文件 images.txt 為空,請確保文件包含有效的鏡像列表信息!
  • 僅僅需要執(zhí)行l(wèi)oad_image時,請確保鏡像存取目錄中存在有你需要的鏡像包。無論是你手動存放的包還是通過腳本pull_and_save的包,需要以".tar"為后綴,若后綴不同,請自行修改腳本。
[root@master01 sulibao]# bash images_pull_save_load_tag_push.sh 
Select the action you want to perform:
1.Pull images.
2.Save images to /data/sulibao/images_2025-02-17
3.Load images from /data/sulibao/images_2025-02-17
4.Replace tag for images and push to target registry
5.Exit.
Please enter the operation number:3
鏡像存取目錄 /data/sulibao/images_2025-02-17 中未發(fā)現(xiàn)鏡像文件,請檢查路徑![root@master01 sulibao]# ll    #此時僅有prepare_environment函數(shù)創(chuàng)建的鏡像存取目錄,實際上無數(shù)據(jù),執(zhí)行失敗的
-rw-r--r-- 1 root root 4695 Feb 17 16:45 images_pull_save_load_tag_push.sh
-rw-r--r-- 1 root root  159 Feb 17 16:53 images.txt
drwxr-xr-x 2 root root    6 Feb 17 16:54 images_2025-02-17
http://www.risenshineclean.com/news/64416.html

相關(guān)文章:

  • 谷搜易外貿(mào)網(wǎng)站建設(shè)站長之家關(guān)鍵詞挖掘工具
  • 如何利用源代碼做網(wǎng)站今日頭條最新
  • 網(wǎng)站建設(shè)需求 百度文庫三十個知識點帶你學(xué)黨章
  • 盛澤做網(wǎng)站的微信賣貨小程序怎么做
  • 設(shè)計廣告圖用什么軟件好用有利于seo優(yōu)化的是
  • 網(wǎng)站的站內(nèi)結(jié)構(gòu)錨文本是如何做的seo指什么
  • 做電影網(wǎng)站模板教學(xué)設(shè)計免費注冊個人網(wǎng)站不花錢
  • java網(wǎng)站開發(fā)是干什么安徽網(wǎng)絡(luò)關(guān)鍵詞優(yōu)化
  • 工信局網(wǎng)站備案查詢溫州seo網(wǎng)站推廣
  • 中國企業(yè)網(wǎng)銀怎么轉(zhuǎn)賬seo推廣軟
  • 石家莊專業(yè)網(wǎng)站設(shè)計電話搜狗競價推廣效果怎么樣
  • 網(wǎng)站做下載功能網(wǎng)站代搭建維護
  • 滄州有沒有做網(wǎng)站的國外網(wǎng)站制作
  • 怎樣進行站點優(yōu)化seo高端培訓(xùn)
  • 什么做網(wǎng)站做個多少錢啊排名優(yōu)化seo
  • wordpress用windows會慢寧波seo關(guān)鍵詞優(yōu)化報價
  • 自己做的網(wǎng)站做登錄網(wǎng)店運營與推廣
  • 做競彩網(wǎng)站代理犯法么站長統(tǒng)計app軟件下載
  • 個人網(wǎng)站可以做企業(yè)宣傳個人如何做seo推廣
  • 吉林seo刷關(guān)鍵詞排名優(yōu)化進一步優(yōu)化
  • 想做程序員需要學(xué)什么黑帽seo技術(shù)
  • 廈門建設(shè)局網(wǎng)站改到哪網(wǎng)站優(yōu)化軟件
  • 網(wǎng)站的服務(wù)器選擇seo品牌優(yōu)化百度資源網(wǎng)站推廣關(guān)鍵詞排名
  • ui設(shè)計技術(shù)培訓(xùn)學(xué)校手機管家一鍵優(yōu)化
  • 網(wǎng)站頁面建議seo優(yōu)化是什么職業(yè)
  • 做網(wǎng)站建設(shè)需要多少錢網(wǎng)絡(luò)營銷模式
  • 優(yōu)質(zhì)網(wǎng)站的衡量標準本地網(wǎng)絡(luò)seo公司
  • 烏審旗建設(shè)局網(wǎng)站seo咨詢價格找推推蛙
  • 福州做網(wǎng)站長沙seo排名扣費
  • wordpress 論壇模版南京seo按天計費