一键安装Harbor仓库(shell脚本)
生活随笔
收集整理的這篇文章主要介紹了
一键安装Harbor仓库(shell脚本)
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
一鍵安裝Harbor倉庫,支持在線和離線安裝
前提是得有docker 和docker-compose環(huán)境
下載博主的腳本和安裝包比在線下載安裝快很多
請安裝前修改正確的hostname 或者自己更換的端口
#!/bin/bash #域名設(shè)置 hostname=192.168.56.24 #端口 port=80 #禁止用戶注冊 self_registration=off #設(shè)置只有管理員可以創(chuàng)建項目 project_creation_restriction=adminonly #登錄密碼 harbor_admin_password=Harbor12345# 當(dāng)前目錄 CURRENT_DIR=$(cd "$(dirname "$0")"pwd )#檢測docker是否安裝 if ! which docker >/dev/null ; thenecho -e "\033[31m 請先安裝docker \033[0m" exit fi#檢測 docker-compose是否安裝 if ! which docker-compose >/dev/null ; thenecho -e "\033[31m 請先安裝docker-compose \033[0m" exit fi##Install if which docker-compose1 >/dev/null; thenecho "檢測到 Docker Compose 已安裝,跳過安裝步驟" elseif [[ -f "$CURRENT_DIR/harbor-offline-installer-v1.2.0.tgz" ]]; thenecho "... 離線安裝 harbor"tar zxf harbor-offline-installer-v1.2.0.tgzcd harborfilePath="$CURRENT_DIR/harbor/harbor.cfg"host=1if [ $port == "80" ]thenhost=$hostnameelse host=$hostname":"$portfi sed -i "s/hostname = reg.mydomain.com/hostname = ${host}/g" $filePathsed -i "s/self_registration = on/self_registration = ${self_registration}/g" $filePathsed -i "s/project_creation_restriction = everyone/project_creation_restriction = ${project_creation_restriction}/g" $filePathsed -i "s/harbor_admin_password = Harbor12345/harbor_admin_password = ${harbor_admin_password}/g" $filePathsed -i "s/80:80/${port}:80/" ./docker-compose.yml./prepare && ./install.shecho "... 離線安裝 harbor 成功"elseecho "... 在線安裝 Harbor"cd $CURRENT_DIRwget https://github.com/vmware/harbor/releases/download/v1.2.0/harbor-online-installer-v1.2.0.tgztar zxf harbor-online-installer-v1.2.0.tgzcd harborfilePath="$CURRENT_DIR/harbor/harbor.cfg"host=1if [ $port == "80" ]thenhost=$hostnameelse host=$hostname":"$portfi sed -i "s/hostname = reg.mydomain.com/hostname = ${host}/g" $filePathsed -i "s/self_registration = on/self_registration = ${self_registration}/g" $filePathsed -i "s/project_creation_restriction = everyone/project_creation_restriction = ${project_creation_restriction}/g" $filePathsed -i "s/harbor_admin_password = Harbor12345/harbor_admin_password = ${harbor_admin_password}/g" $filePathsed -i "s/80:80/${port}:80/" ./docker-compose.ymlchmod +x install.sh./install.sh || exitdocker-compose ps echo "... 在線安裝 Harbor 成功"fi fi在網(wǎng)絡(luò)條件不好的情況下建議離線安裝,請先下載下面的包
離線的安裝包
鏈接:https://pan.baidu.com/s/1X1JCDJktoQ1OCBgqZVMsyA
提取碼:7ab5
總結(jié)
以上是生活随笔為你收集整理的一键安装Harbor仓库(shell脚本)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 分别使用BP/RBF/GRNN神经网络识
- 下一篇: 施耐德PLC与迪文DGUSⅡ屏软硬件连接