harbor离线安装
1、安装docker环境
## 配置加速器
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://172.31.0.10:443","https://2v36sw26.mirror.aliyuncs.com"],
"exec-opts": ["native.cgroupdriver=systemd"],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
},
"storage-driver": "overlay2"
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
#此处报错缺乏依赖,需要下载依赖,强制安装
container-selinux-2.107-1.el7_6.noarch.rpm
fuse-overlayfs-0.7.2-6.el7_8.x86_64.rpm
slirp4netns-0.4.3-4.el7_8.x86_64.rpm
rpm -ivh --force --nodeps container-selinux-2.107-1.el7_6.noarch.rpm
rpm -ivh --force --nodeps fuse-overlayfs-0.7.2-6.el7_8.x86_64.rpm
rpm -ivh --force --nodeps slirp4netns-0.4.3-4.el7_8.x86_64.rpm
## 安装docker
yum install -y docker-ce-20.10.7 docker-ce-cli-20.10.7 containerd.io-1.4.6
## 重新加载配置文件
systemctl daemon-reload
## 启动docker
systemctl restart docker
## 设置开机自启
systemctl enable docker.service
## docker安装成功
docker -v
## 查看安装的docker
yum list installed | grep docker
## 卸载docker
yum -y remove docker....
## 如果出现yum错误,需要修改提示的文件的python2环境
https://blog.csdn.net/weixin_49978753/article/details/124451984
2、安装docker-compos
## linux命令下载
sudo curl -L "https://github.com/docker/compose/releases/download/2.11.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
## 浏览器下载
https://github.com/docker/compose/releases/tag/v2.11.2
## 浏览器下载需要修改名称
mv docker-compose-linux-x86_64 docker-compose
## 将文件cp到/usr/local/bin/一份,可执行文件
cp docker-compose /usr/local/bin/
## 授权
chmod +x /usr/local/bin/docker-compose
## 查看是否安装成功
docker-compose -v
2、安装harbor
1、下载harbor
https://github.com/goharbor/harbor/releases/download/v2.6.0/harbor-offline-installer-v2.6.0.tgz
2、解压harbor
## 解压harbor
tar -zxvf harbor-offline-installer-v2.4.1.tgz
3、修改配置文件
6 hostname: 172.31.0.170
13 # https related config
14 #https:
15 # https port for harbor, default is 443
16 # port: 443
17 # The path of cert and key files for nginx
18 #certificate: /your/certificate/path
19 #private_key: /your/private/key/path
4、加载镜像及安装
## 加载 镜像
docker load -i harbor.v2.3.4.tar.gz
## 查看镜像
docker images | grep goharbor
## 为Harbor生成配置文件
./prepare
## 安装harbor
./install.sh
## 如果修改了配置文件需要重启harbor
## 为Harbor生成配置文件
./prepare
## 如果Harbor已在运行,请停止并删除现有实例。您的图像数据保留在文件系统中
docker-compose down -v
## 最后,重启harbor:
docker-compose up -d
5、测试登录harbor
https://172.31.0.11:443/
admin/Harbor12345
docker login -u admin -p Harbor12345 172.31.0.170:80
6、docker推送命令
Docker 推送命令
登录harbor
docker login -u admin -p admin 172.31.0.11
在项目中标记镜像:
docker tag SOURCE_IMAGE[:TAG] 172.31.0,170/libotao/REPOSITORY[:TAG]
docker tag SOURCE_IMAGE[:TAG] 172.31.0,170/libotao/REPOSITORY[:TAG]
推送镜像到当前项目:
docker push 172.31.0,170/libotao/REPOSITORY[:TAG]
docker push 172.31.0,170/libotao/REPOSITORY[:TAG]
Helm 推送命令
在项目中标记 chart
helm chart save CHART_PATH 172.31.0,170/libotao/REPOSITORY[:TAG]
helm chart save CHART_PATH 172.31.0,170/libotao/REPOSITORY[:TAG]
推送 chart 到当前项目
helm chart push 172.31.0,170/libotao/REPOSITORY[:TAG]
helm chart push 172.31.0,170/libotao/REPOSITORY[:TAG]
CNAB 推送命令
推送 CNAB 到当前项目
cnab-to-oci push CNAB_PATH --target 172.31.0,170/libotao/REPOSITORY[:TAG] --auto-update-bundle
cnab-to-oci push CNAB_PATH --target 172.31.0,170/libotao/REPOSITORY[:TAG] --auto-update-bundle
标签:compose,harbor,##,TAG,docker,安装,172.31
From: https://www.cnblogs.com/botaoli/p/16794618.html