版本信息
docker-ce:20.10.17
containerd:1.6.7
runc:1.1.3
harbor:2.5.3
docker-compose:2.3.4
一、使用apt-get安装docker(建议使用清华的源,速度比较快)
# step 1: 安装必要的一些系统工具
sudo apt-get update
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
# step 2: 安装GPG证书
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
# Step 3: 写入软件源信息
sudo add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
# Step 4: 更新并安装Docker-CE
sudo apt-get -y update
sudo apt-get -y install docker-ce
# 安装指定版本的Docker-CE:
# Step 1: 查找Docker-CE的版本:
# apt-cache madison docker-ce
# docker-ce | 17.03.1~ce-0~ubuntu-xenial | https://mirrors.aliyun.com/docker-ce/linux/ubuntu xenial/stable amd64 Packages
# docker-ce | 17.03.0~ce-0~ubuntu-xenial | https://mirrors.aliyun.com/docker-ce/linux/ubuntu xenial/stable amd64 Packages
# Step 2: 安装指定版本的Docker-CE: (VERSION例如上面的17.03.1~ce-0~ubuntu-xenial)
# sudo apt-get -y install docker-ce=[VERSION]
二、安装harbor
1.下载harbor离线安装包
github官网首页搜索harbor -> 点击release -> 选择目标版本并下载
root@ecs-67093:/apps# wget https://github.com/goharbor/harbor/releases/download/v2.5.3/harbor-offline-installer-v2.5.3.tgz
2.下载docker-compose
wget https://github.com/docker/compose/releases/download/v2.3.4/docker-compose-linux-x86_64
root@ecs-67093:/apps# chmod a+x docker-compose-linux-x86_64
root@ecs-67093:/apps# mv docker-compose-linux-x86_64 /usr/bin/docker-compose
root@ecs-67093:/apps# docker-compose version
Docker Compose version v2.3.4
3.修改harbor配置
root@ecs-67093:/apps# tar xvf harbor-offline-installer-v2.5.3.tgz
root@ecs-67093:/apps# cd harbor/
root@ecs-67093:/apps/harbor# cp harbor.yml.tmpl harbor.yml
root@ecs-67093:/apps/harbor# vim harbor.yml
hostname: harbor.magedu.net # 修改域名
https:
# https port for harbor, default is 443
port: 443
# The path of cert and key files for nginx
certificate: /apps/harbor/certs/magedu.net.crt # 证书自签发
private_key: /apps/harbor/certs/magedu.net.key # 证书自签发
harbor_admin_password: 123456
data_volume: /data/harbor
4.安装
root@ecs-67093:/apps/harbor# ./install.sh --with-trivy --with-chartmuseum
✔ ----Harbor has been installed and started successfully.----