1、下载docker和harbor版本(版本自选)

docker下载地址: https://download.docker.com/linux/static/stable/x86_64/
harbor下载地址: https://github.com/goharbor/harbor/releases/
docker-compose下载地址: https://github.com/docker/compose/releases/

2、上传docker压缩包并解压 

tar -xvf docker-20.10.8.tgz
tar xvf harbor-offline-installer-v2.5.0.tgz

3、将解压出来的docker文件移动到 /usr/bin/ 目录下

mv docker/* /usr/bin

4、创建docker.service文件

vim /usr/lib/systemd/system/docker.service

[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
[Service]
Type=notify
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
TimeoutStartSec=0
Delegate=yes
KillMode=process
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target

5、配置docker的daemon

mkdir /etc/docker
vim /etc/docker/daemon.json

{
  "exec-opts": ["native.cgroupdriver=systemd"],  #kubernetes推荐使用
  "registry-mirrors": ["https://kn0t2bca.mirror.aliyuncs.com"], #阿里镜像加速
  "graph":"/data/docker",                                   #指定目录
  "insecure-registries": ["10.0.0.10"]                      #harbor
}

6、重新加载配置,设置开机自启,启动docker

systemctl daemon-reload
systemctl enable docker 
systemctl start docker  

#查看docker状态
 systemctl status docker 
#查看当前版本信息
 docker version 

7、安装harbor前需要安装docker-compose

mv docker-compose-linux-x86_64  /usr/bin/docker-compose
chmod +x /usr/bin/docker-compose

8、验证 docker-compose 是否安装成功 

docker-compose version

9、安装harbor修改harbor 配置文件

cd harbor
cp harbor.yml.tmpl harbor.yml

根据需求修改配置文件这里端口用默认的80,协议是http(https需要注释掉)
hostname: 10.0.0.10
harbor_admin_password: harbor123

10、执行安装脚本

./install.sh

11、检查是否部署成功 #服务都是running状态

docker-compose ps  #或docker ps查看

12、测试

http://10.0.0.10

 

posted on 2022-06-02 21:10  宇小白  阅读(336)  评论(0编辑  收藏  举报