# step 1: 安装必要的一些系统工具
[root@linux-001 ~]# yum install -y yum-utils device-mapper-persistent-data lvm2
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
epel/x86_64/metalink | 5.3 kB 00:00:00
* base: mirrors.aliyun.com
* centos-sclo-rh: mirrors.aliyun.com
* centos-sclo-sclo: mirrors.aliyun.com
* epel: mirror.sjtu.edu.cn
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
base | 3.6 kB 00:00:00
centos-sclo-rh | 3.0 kB 00:00:00
centos-sclo-sclo | 3.0 kB 00:00:00
epel | 4.7 kB 00:00:00
extras | 2.9 kB 00:00:00
salt-latest | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
zabbix | 2.9 kB 00:00:00
zabbix-non-supported | 2.9 kB 00:00:00
(1/3): epel/x86_64/updateinfo | 1.0 MB 00:00:06
(2/3): epel/x86_64/primary_db | 6.9 MB 00:00:00
(3/3): updates/7/x86_64/primary_db | 5.6 MB 00:00:06
软件包 yum-utils-1.1.31-54.el7_8.noarch 已安装并且是最新版本
正在解决依赖关系
--> 正在检查事务
---> 软件包 device-mapper-persistent-data.x86_64.0.0.8.5-3.el7_9.2 将被 安装
---> 软件包 lvm2.x86_64.7.2.02.187-6.el7_9.3 将被 安装
--> 正在处理依赖关系 lvm2-libs = 7:2.02.187-6.el7_9.3,它被软件包 7:lvm2-2.02.187-6.el7_9.3.x86_64 需要
--> 正在处理依赖关系 liblvm2app.so.2.2(Base)(64bit),它被软件包 7:lvm2-2.02.187-6.el7_9.3.x86_64 需要
--> 正在处理依赖关系 libdevmapper-event.so.1.02(Base)(64bit),它被软件包 7:lvm2-2.02.187-6.el7_9.3.x86_64 需要
--> 正在处理依赖关系 liblvm2app.so.2.2()(64bit),它被软件包 7:lvm2-2.02.187-6.el7_9.3.x86_64 需要
--> 正在处理依赖关系 libdevmapper-event.so.1.02()(64bit),它被软件包 7:lvm2-2.02.187-6.el7_9.3.x86_64 需要
--> 正在检查事务
---> 软件包 device-mapper-event-libs.x86_64.7.1.02.170-6.el7_9.3 将被 安装
---> 软件包 lvm2-libs.x86_64.7.2.02.187-6.el7_9.3 将被 安装
--> 正在处理依赖关系 device-mapper-event = 7:1.02.170-6.el7_9.3,它被软件包 7:lvm2-libs-2.02.187-6.el7_9.3.x86_64 需要
--> 正在检查事务
---> 软件包 device-mapper-event.x86_64.7.1.02.170-6.el7_9.3 将被 安装
--> 正在处理依赖关系 device-mapper = 7:1.02.170-6.el7_9.3,它被软件包 7:device-mapper-event-1.02.170-6.el7_9.3.x86_64 需要
--> 正在检查事务
---> 软件包 device-mapper.x86_64.7.1.02.149-8.el7 将被 升级
--> 正在处理依赖关系 device-mapper = 7:1.02.149-8.el7,它被软件包 7:device-mapper-libs-1.02.149-8.el7.x86_64 需要
---> 软件包 device-mapper.x86_64.7.1.02.170-6.el7_9.3 将被 更新
--> 正在检查事务
---> 软件包 device-mapper-libs.x86_64.7.1.02.149-8.el7 将被 升级
---> 软件包 device-mapper-libs.x86_64.7.1.02.170-6.el7_9.3 将被 更新
--> 解决依赖关系完成
依赖关系解决
==================================================================================================================================================================================================================
Package 架构 版本 源 大小
==================================================================================================================================================================================================================
正在安装:
device-mapper-persistent-data x86_64 0.8.5-3.el7_9.2 updates 423 k
lvm2 x86_64 7:2.02.187-6.el7_9.3 updates 1.3 M
为依赖而安装:
device-mapper-event x86_64 7:1.02.170-6.el7_9.3 updates 192 k
device-mapper-event-libs x86_64 7:1.02.170-6.el7_9.3 updates 191 k
lvm2-libs x86_64 7:2.02.187-6.el7_9.3 updates 1.1 M
为依赖而更新:
device-mapper x86_64 7:1.02.170-6.el7_9.3 updates 297 k
device-mapper-libs x86_64 7:1.02.170-6.el7_9.3 updates 325 k
事务概要
==================================================================================================================================================================================================================
安装 2 软件包 (+3 依赖软件包)
升级 ( 2 依赖软件包)
总下载量:3.8 M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/7): device-mapper-1.02.170-6.el7_9.3.x86_64.rpm | 297 kB 00:00:00
(2/7): device-mapper-event-libs-1.02.170-6.el7_9.3.x86_64.rpm | 191 kB 00:00:00
(3/7): device-mapper-libs-1.02.170-6.el7_9.3.x86_64.rpm | 325 kB 00:00:00
(4/7): device-mapper-persistent-data-0.8.5-3.el7_9.2.x86_64.rpm | 423 kB 00:00:00
(5/7): lvm2-2.02.187-6.el7_9.3.x86_64.rpm | 1.3 MB 00:00:00
(6/7): lvm2-libs-2.02.187-6.el7_9.3.x86_64.rpm | 1.1 MB 00:00:00
(7/7): device-mapper-event-1.02.170-6.el7_9.3.x86_64.rpm | 192 kB 00:00:05
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计 677 kB/s | 3.8 MB 00:00:05
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在更新 : 7:device-mapper-1.02.170-6.el7_9.3.x86_64 1/9
正在更新 : 7:device-mapper-libs-1.02.170-6.el7_9.3.x86_64 2/9
正在安装 : 7:device-mapper-event-libs-1.02.170-6.el7_9.3.x86_64 3/9
正在安装 : 7:device-mapper-event-1.02.170-6.el7_9.3.x86_64 4/9
正在安装 : 7:lvm2-libs-2.02.187-6.el7_9.3.x86_64 5/9
正在安装 : device-mapper-persistent-data-0.8.5-3.el7_9.2.x86_64 6/9
正在安装 : 7:lvm2-2.02.187-6.el7_9.3.x86_64 7/9
清理 : 7:device-mapper-1.02.149-8.el7.x86_64 8/9
清理 : 7:device-mapper-libs-1.02.149-8.el7.x86_64 9/9
验证中 : 7:device-mapper-event-libs-1.02.170-6.el7_9.3.x86_64 1/9
验证中 : 7:device-mapper-event-1.02.170-6.el7_9.3.x86_64 2/9
验证中 : device-mapper-persistent-data-0.8.5-3.el7_9.2.x86_64 3/9
验证中 : 7:device-mapper-libs-1.02.170-6.el7_9.3.x86_64 4/9
验证中 : 7:lvm2-libs-2.02.187-6.el7_9.3.x86_64 5/9
验证中 : 7:device-mapper-1.02.170-6.el7_9.3.x86_64 6/9
验证中 : 7:lvm2-2.02.187-6.el7_9.3.x86_64 7/9
验证中 : 7:device-mapper-1.02.149-8.el7.x86_64 8/9
验证中 : 7:device-mapper-libs-1.02.149-8.el7.x86_64 9/9
已安装:
device-mapper-persistent-data.x86_64 0:0.8.5-3.el7_9.2 lvm2.x86_64 7:2.02.187-6.el7_9.3
作为依赖被安装:
device-mapper-event.x86_64 7:1.02.170-6.el7_9.3 device-mapper-event-libs.x86_64 7:1.02.170-6.el7_9.3 lvm2-libs.x86_64 7:2.02.187-6.el7_9.3
作为依赖被升级:
device-mapper.x86_64 7:1.02.170-6.el7_9.3 device-mapper-libs.x86_64 7:1.02.170-6.el7_9.3
完毕!
# Step 2: 添加软件源信息
[root@linux-001 ~]# yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
已加载插件:fastestmirror
adding repo from: https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
grabbing file https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo
# Step 3
[root@linux-001 ~]# sed -i 's+download.docker.com+mirrors.aliyun.com/docker-ce+' /etc/yum.repos.d/docker-ce.repo
# Step 4: 更新并安装Docker-CE
[root@linux-001 ~]# yum makecache fast
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
epel/x86_64/metalink | 5.3 kB 00:00:00
* base: mirrors.aliyun.com
* centos-sclo-rh: mirrors.aliyun.com
* centos-sclo-sclo: mirrors.aliyun.com
* epel: mirror.sjtu.edu.cn
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
base | 3.6 kB 00:00:00
centos-sclo-rh | 3.0 kB 00:00:00
centos-sclo-sclo | 3.0 kB 00:00:00
docker-ce-stable | 3.5 kB 00:00:00
extras | 2.9 kB 00:00:00
salt-latest | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
zabbix | 2.9 kB 00:00:00
zabbix-non-supported | 2.9 kB 00:00:00
(1/2): docker-ce-stable/7/x86_64/updateinfo | 55 B 00:00:05
(2/2): docker-ce-stable/7/x86_64/primary_db | 56 kB 00:00:10
元数据缓存已建立
[root@linux-001 ~]# yum -y install docker-ce
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* centos-sclo-rh: mirrors.aliyun.com
* centos-sclo-sclo: mirrors.aliyun.com
* epel: mirror.sjtu.edu.cn
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 docker-ce.x86_64.3.20.10.4-3.el7 将被 安装
--> 正在处理依赖关系 container-selinux >= 2:2.74,它被软件包 3:docker-ce-20.10.4-3.el7.x86_64 需要
--> 正在处理依赖关系 containerd.io >= 1.4.1,它被软件包 3:docker-ce-20.10.4-3.el7.x86_64 需要
--> 正在处理依赖关系 libseccomp >= 2.3,它被软件包 3:docker-ce-20.10.4-3.el7.x86_64 需要
--> 正在处理依赖关系 docker-ce-cli,它被软件包 3:docker-ce-20.10.4-3.el7.x86_64 需要
--> 正在处理依赖关系 docker-ce-rootless-extras,它被软件包 3:docker-ce-20.10.4-3.el7.x86_64 需要
--> 正在检查事务
---> 软件包 container-selinux.noarch.2.2.119.2-1.911c772.el7_8 将被 安装
---> 软件包 containerd.io.x86_64.0.1.4.3-3.1.el7 将被 安装
---> 软件包 docker-ce-cli.x86_64.1.20.10.4-3.el7 将被 安装
---> 软件包 docker-ce-rootless-extras.x86_64.0.20.10.4-3.el7 将被 安装
--> 正在处理依赖关系 fuse-overlayfs >= 0.7,它被软件包 docker-ce-rootless-extras-20.10.4-3.el7.x86_64 需要
--> 正在处理依赖关系 slirp4netns >= 0.4,它被软件包 docker-ce-rootless-extras-20.10.4-3.el7.x86_64 需要
---> 软件包 libseccomp.x86_64.0.2.3.1-4.el7 将被 安装
--> 正在检查事务
---> 软件包 fuse-overlayfs.x86_64.0.0.7.2-6.el7_8 将被 安装
--> 正在处理依赖关系 libfuse3.so.3(FUSE_3.2)(64bit),它被软件包 fuse-overlayfs-0.7.2-6.el7_8.x86_64 需要
--> 正在处理依赖关系 libfuse3.so.3(FUSE_3.0)(64bit),它被软件包 fuse-overlayfs-0.7.2-6.el7_8.x86_64 需要
--> 正在处理依赖关系 libfuse3.so.3()(64bit),它被软件包 fuse-overlayfs-0.7.2-6.el7_8.x86_64 需要
---> 软件包 slirp4netns.x86_64.0.0.4.3-4.el7_8 将被 安装
--> 正在检查事务
---> 软件包 fuse3-libs.x86_64.0.3.6.1-4.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
==================================================================================================================================================================================================================
Package 架构 版本 源 大小
==================================================================================================================================================================================================================
正在安装:
docker-ce x86_64 3:20.10.4-3.el7 docker-ce-stable 27 M
为依赖而安装:
container-selinux noarch 2:2.119.2-1.911c772.el7_8 extras 40 k
containerd.io x86_64 1.4.3-3.1.el7 docker-ce-stable 33 M
docker-ce-cli x86_64 1:20.10.4-3.el7 docker-ce-stable 33 M
docker-ce-rootless-extras x86_64 20.10.4-3.el7 docker-ce-stable 9.1 M
fuse-overlayfs x86_64 0.7.2-6.el7_8 extras 54 k
fuse3-libs x86_64 3.6.1-4.el7 extras 82 k
libseccomp x86_64 2.3.1-4.el7 base 56 k
slirp4netns x86_64 0.4.3-4.el7_8 extras 81 k
事务概要
==================================================================================================================================================================================================================
安装 1 软件包 (+8 依赖软件包)
总下载量:102 M
安装大小:423 M
Downloading packages:
警告:/var/cache/yum/x86_64/7/docker-ce-stable/packages/containerd.io-1.4.3-3.1.el7.x86_64.rpm: 头V4 RSA/SHA512 Signature, 密钥 ID 621e9f35: NOKEY ] 7.7 MB/s | 31 MB 00:00:09 ETA
containerd.io-1.4.3-3.1.el7.x86_64.rpm 的公钥尚未安装
(1/9): containerd.io-1.4.3-3.1.el7.x86_64.rpm | 33 MB 00:00:03
(2/9): container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm | 40 kB 00:00:05
(3/9): docker-ce-cli-20.10.4-3.el7.x86_64.rpm | 33 MB 00:00:03
(4/9): docker-ce-rootless-extras-20.10.4-3.el7.x86_64.rpm | 9.1 MB 00:00:01
(5/9): fuse-overlayfs-0.7.2-6.el7_8.x86_64.rpm | 54 kB 00:00:06
(6/9): slirp4netns-0.4.3-4.el7_8.x86_64.rpm | 81 kB 00:00:00
(7/9): fuse3-libs-3.6.1-4.el7.x86_64.rpm | 82 kB 00:00:06
(8/9): libseccomp-2.3.1-4.el7.x86_64.rpm | 56 kB 00:00:06
(9/9): docker-ce-20.10.4-3.el7.x86_64.rpm | 27 MB 00:00:17
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计 5.9 MB/s | 102 MB 00:00:17
从 https://mirrors.aliyun.com/docker-ce/linux/centos/gpg 检索密钥
导入 GPG key 0x621E9F35:
用户ID : "Docker Release (CE rpm) <docker@docker.com>"
指纹 : 060a 61c5 1b55 8a7f 742b 77aa c52f eb6b 621e 9f35
来自 : https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : libseccomp-2.3.1-4.el7.x86_64 1/9
正在安装 : 2:container-selinux-2.119.2-1.911c772.el7_8.noarch 2/9
setsebool: SELinux is disabled.
正在安装 : containerd.io-1.4.3-3.1.el7.x86_64 3/9
正在安装 : slirp4netns-0.4.3-4.el7_8.x86_64 4/9
正在安装 : 1:docker-ce-cli-20.10.4-3.el7.x86_64 5/9
正在安装 : fuse3-libs-3.6.1-4.el7.x86_64 6/9
正在安装 : fuse-overlayfs-0.7.2-6.el7_8.x86_64 7/9
正在安装 : 3:docker-ce-20.10.4-3.el7.x86_64 8/9
正在安装 : docker-ce-rootless-extras-20.10.4-3.el7.x86_64 9/9
验证中 : docker-ce-rootless-extras-20.10.4-3.el7.x86_64 1/9
验证中 : fuse3-libs-3.6.1-4.el7.x86_64 2/9
验证中 : 3:docker-ce-20.10.4-3.el7.x86_64 3/9
验证中 : fuse-overlayfs-0.7.2-6.el7_8.x86_64 4/9
验证中 : slirp4netns-0.4.3-4.el7_8.x86_64 5/9
验证中 : 2:container-selinux-2.119.2-1.911c772.el7_8.noarch 6/9
验证中 : libseccomp-2.3.1-4.el7.x86_64 7/9
验证中 : containerd.io-1.4.3-3.1.el7.x86_64 8/9
验证中 : 1:docker-ce-cli-20.10.4-3.el7.x86_64 9/9
已安装:
docker-ce.x86_64 3:20.10.4-3.el7
作为依赖被安装:
container-selinux.noarch 2:2.119.2-1.911c772.el7_8 containerd.io.x86_64 0:1.4.3-3.1.el7 docker-ce-cli.x86_64 1:20.10.4-3.el7 docker-ce-rootless-extras.x86_64 0:20.10.4-3.el7
fuse-overlayfs.x86_64 0:0.7.2-6.el7_8 fuse3-libs.x86_64 0:3.6.1-4.el7 libseccomp.x86_64 0:2.3.1-4.el7 slirp4netns.x86_64 0:0.4.3-4.el7_8
完毕!
# Step 5: 启动DOCKER服务,检测服务启动情况
[root@linux-001 ~]# ll /usr/lib/systemd/system/docker.service
-rw-r--r-- 1 root root 1695 2月 25 15:06 /usr/lib/systemd/system/docker.service
[root@linux-001 ~]# systemctl start docker
[root@linux-001 ~]# ps -ef |grep docker
root 16491 1 0 09:24 ? 00:00:00 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
root 16633 12335 0 09:24 pts/1 00:00:00 grep --color=auto docker
[root@linux-001 ~]# docker version
Client: Docker Engine - Community
Version: 20.10.4
API version: 1.41
Go version: go1.13.15
Git commit: d3cb89e
Built: Thu Feb 25 07:06:20 2021
OS/Arch: linux/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.4
API version: 1.41 (minimum version 1.12)
Go version: go1.13.15
Git commit: 363e9a8
Built: Thu Feb 25 07:04:45 2021
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.4.3
GitCommit: 269548fa27e0089a8b8278fc4fc781d7f65a939b
runc:
Version: 1.0.0-rc92
GitCommit: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
docker-init:
Version: 0.19.0
GitCommit: de40ad0
# Step 6: 设置DOCKER镜像加速
[root@linux-001 ~]# mkdir -p /etc/docker
[root@linux-001 ~]# tee /etc/docker/daemon.json <<-'EOF'
> {
> "registry-mirrors": ["https://cqlpr39i.mirror.aliyuncs.com"]
> }
> EOF
{
"registry-mirrors": ["https://cqlpr39i.mirror.aliyuncs.com"]
}
[root@linux-001 ~]# systemctl daemon-reload
[root@linux-001 ~]# systemctl restart docker
# 检查docker加速服务是否生效
[root@linux-001 ~]# docker info
Client:
Context: default
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 20.10.4
Storage Driver: overlay2
Backing Filesystem: xfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 269548fa27e0089a8b8278fc4fc781d7f65a939b
runc version: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
init version: de40ad0
Security Options:
seccomp
Profile: default
Kernel Version: 3.10.0-957.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.777GiB
Name: linux-001
ID: Y444:EWTN:FOI7:M5VT:LM5M:UAZT:5SHZ:DGKK:EYKT:VBEZ:7A7Q:JAS6
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Registry Mirrors:
https://cqlpr39i.mirror.aliyuncs.com/
Live Restore Enabled: false
# 下载docker-compose,下载地址:https://github.com/docker/compose/releases/download/1.28.5/docker-compose-Linux-x86_64
# 由于wget下载一直失败,在windows上下载好然后传入centos系统中。
[root@linux-001 ~]# mv docker-compose-Linux-x86_64 /usr/local/bin/docker-compose
[root@linux-001 ~]# chmod 755 /usr/local/bin/docker-compose
[root@linux-001 ~]# docker-compose version
docker-compose version 1.28.5, build c4eb3a1f
docker-py version: 4.4.4
CPython version: 3.7.10
OpenSSL version: OpenSSL 1.1.0l 10 Sep 2019
[root@linux-001 ~]# wget https://github.com/goharbor/harbor/releases/download/v2.2.0/harbor-offline-installer-v2.2.0.tgz
--2021-03-01 09:49:07-- https://github.com/goharbor/harbor/releases/download/v2.2.0/harbor-offline-installer-v2.2.0.tgz
正在解析主机 github.com (github.com)... 13.229.188.59
正在连接 github.com (github.com)|13.229.188.59|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 302 Found
位置:https://github-releases.githubusercontent.com/50613991/46930680-76b9-11eb-9d53-44c23f311b61?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210301%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210301T014912Z&X-Amz-Expires=300&X-Amz-Signature=ccf4191be5a20933da9b1f472f0e620c5cb690042af95b75fddffce6f0dd09d2&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=50613991&response-content-disposition=attachment%3B%20filename%3Dharbor-offline-installer-v2.2.0.tgz&response-content-type=application%2Foctet-stream [跟随至新的 URL]
--2021-03-01 09:49:13-- https://github-releases.githubusercontent.com/50613991/46930680-76b9-11eb-9d53-44c23f311b61?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210301%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210301T014912Z&X-Amz-Expires=300&X-Amz-Signature=ccf4191be5a20933da9b1f472f0e620c5cb690042af95b75fddffce6f0dd09d2&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=50613991&response-content-disposition=attachment%3B%20filename%3Dharbor-offline-installer-v2.2.0.tgz&response-content-type=application%2Foctet-stream
正在解析主机 github-releases.githubusercontent.com (github-releases.githubusercontent.com)... 185.199.110.154, 185.199.108.154, 185.199.109.154, ...
正在连接 github-releases.githubusercontent.com (github-releases.githubusercontent.com)|185.199.110.154|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:516131175 (492M) [application/octet-stream]
正在保存至: “harbor-offline-installer-v2.2.0.tgz”
100%[========================================================================================================================================================================>] 516,131,175 4.09MB/s 用时 10m 34s
2021-03-01 09:59:48 (795 KB/s) - 已保存 “harbor-offline-installer-v2.2.0.tgz” [516131175/516131175])
[root@linux-001 ~]# tar -xvf harbor-offline-installer-v2.2.0.tgz -C /opt/
harbor/harbor.v2.2.0.tar.gz
harbor/prepare
harbor/LICENSE
harbor/install.sh
harbor/common.sh
harbor/harbor.yml.tmpl
[root@linux-001 ~]# ll /opt/harbor/
总用量 506244
-rw-r--r-- 1 root root 3361 2月 23 14:06 common.sh
-rw-r--r-- 1 root root 518358127 2月 23 14:07 harbor.v2.2.0.tar.gz
-rw-r--r-- 1 root root 7840 2月 23 14:06 harbor.yml.tmpl
-rwxr-xr-x 1 root root 2500 2月 23 14:06 install.sh
-rw-r--r-- 1 root root 11347 2月 23 14:06 LICENSE
-rwxr-xr-x 1 root root 1881 2月 23 14:06 prepare
上文已经把harbor下载好,接下来需要修改配置文件,我便自己填写了一个yml的配置文件,发现报错了,如下:
## 注意此步是自己编写的yml文件,但是会出现下面的报错信息,提示data_volume找不到
[root@linux-001 harbor]# cat harbor.yml
hostname: harbor.ideacome.com
certificate: /opt/harbor/ideacome.crt
private_key: /opt/harbor/ideacome.key
harbor_admin_password: harbor-12345
[root@linux-003 harbor]# sh install.sh
[Step 0]: checking if docker is installed ...
Note: docker version: 20.10.4
[Step 1]: checking docker-compose is installed ...
Note: docker-compose version: 1.28.5
[Step 2]: loading Harbor images ...
07ed3fe22282: Loading layer [==================================================>] 34.51MB/34.51MB
632651017131: Loading layer [==================================================>] 8.071MB/8.071MB
cff019bd8e54: Loading layer [==================================================>] 3.584kB/3.584kB
db8113c9a129: Loading layer [==================================================>] 2.56kB/2.56kB
04eaffb344c9: Loading layer [==================================================>] 61.03MB/61.03MB
30932a235d0d: Loading layer [==================================================>] 61.85MB/61.85MB
Loaded image: goharbor/harbor-jobservice:v2.2.0
68170e81b04b: Loading layer [==================================================>] 34.51MB/34.51MB
c0276ff1011e: Loading layer [==================================================>] 7.815MB/7.815MB
892518eb7e09: Loading layer [==================================================>] 17.61MB/17.61MB
25f373af3c04: Loading layer [==================================================>] 4.608kB/4.608kB
df5c0f8011ee: Loading layer [==================================================>] 18.43MB/18.43MB
Loaded image: goharbor/harbor-exporter:v2.2.0
d6b0c623c73b: Loading layer [==================================================>] 4.933MB/4.933MB
494ceea2a6b4: Loading layer [==================================================>] 4.096kB/4.096kB
64e95a63b7a3: Loading layer [==================================================>] 3.072kB/3.072kB
f2c35b3b0dcd: Loading layer [==================================================>] 18.99MB/18.99MB
5c74d99fc846: Loading layer [==================================================>] 19.81MB/19.81MB
Loaded image: goharbor/registry-photon:v2.2.0
3fbc0344880d: Loading layer [==================================================>] 8.072MB/8.072MB
9c5adc52de0d: Loading layer [==================================================>] 3.584kB/3.584kB
05781011aa08: Loading layer [==================================================>] 2.56kB/2.56kB
19e4b43530bc: Loading layer [==================================================>] 53.27MB/53.27MB
9a88bba5ca8d: Loading layer [==================================================>] 5.632kB/5.632kB
7c2bf6707239: Loading layer [==================================================>] 87.55kB/87.55kB
b1aeff496e1d: Loading layer [==================================================>] 11.78kB/11.78kB
f8d3079c10d4: Loading layer [==================================================>] 54.2MB/54.2MB
eb473baf6abd: Loading layer [==================================================>] 2.56kB/2.56kB
Loaded image: goharbor/harbor-core:v2.2.0
f649b07d9770: Loading layer [==================================================>] 63.77MB/63.77MB
a1252bd74521: Loading layer [==================================================>] 80MB/80MB
12a45cabca01: Loading layer [==================================================>] 6.144kB/6.144kB
cb64020cac49: Loading layer [==================================================>] 2.56kB/2.56kB
11273c337dac: Loading layer [==================================================>] 2.56kB/2.56kB
06bf2b44257c: Loading layer [==================================================>] 2.56kB/2.56kB
ae1d550e31f7: Loading layer [==================================================>] 2.56kB/2.56kB
5418b645d05a: Loading layer [==================================================>] 11.26kB/11.26kB
Loaded image: goharbor/harbor-db:v2.2.0
165bc38d4a20: Loading layer [==================================================>] 4.926MB/4.926MB
4450dd70e473: Loading layer [==================================================>] 5.926MB/5.926MB
571aff5ac473: Loading layer [==================================================>] 14.86MB/14.86MB
7213db5cd3f6: Loading layer [==================================================>] 27.36MB/27.36MB
feb90353404b: Loading layer [==================================================>] 22.02kB/22.02kB
2bf612d23dd5: Loading layer [==================================================>] 14.86MB/14.86MB
Loaded image: goharbor/notary-server-photon:v2.2.0
75b7bc9e1233: Loading layer [==================================================>] 6.237MB/6.237MB
45cc62077a3e: Loading layer [==================================================>] 4.096kB/4.096kB
0254af6d0275: Loading layer [==================================================>] 3.072kB/3.072kB
6b42f8a7f98d: Loading layer [==================================================>] 28.3MB/28.3MB
4c3750e9c704: Loading layer [==================================================>] 11.38MB/11.38MB
2f3db0c6619f: Loading layer [==================================================>] 40.5MB/40.5MB
Loaded image: goharbor/trivy-adapter-photon:v2.2.0
bbd0a1895331: Loading layer [==================================================>] 4.933MB/4.933MB
5db7b6078317: Loading layer [==================================================>] 4.096kB/4.096kB
b2a993735d1e: Loading layer [==================================================>] 18.99MB/18.99MB
46f8d3251467: Loading layer [==================================================>] 3.072kB/3.072kB
36435ed81d46: Loading layer [==================================================>] 25.32MB/25.32MB
586ede682f3f: Loading layer [==================================================>] 45.14MB/45.14MB
Loaded image: goharbor/harbor-registryctl:v2.2.0
59cead1174d4: Loading layer [==================================================>] 35.94MB/35.94MB
8c26e21f2027: Loading layer [==================================================>] 3.072kB/3.072kB
741a65c6dac7: Loading layer [==================================================>] 59.9kB/59.9kB
438633fad008: Loading layer [==================================================>] 61.95kB/61.95kB
Loaded image: goharbor/redis-photon:v2.2.0
2fc5cd36d28c: Loading layer [==================================================>] 76.07MB/76.07MB
6a135eaee93d: Loading layer [==================================================>] 3.584kB/3.584kB
e5c3feb6aca0: Loading layer [==================================================>] 3.072kB/3.072kB
a31d1977777a: Loading layer [==================================================>] 2.56kB/2.56kB
0969721e9ff9: Loading layer [==================================================>] 3.072kB/3.072kB
e790c9ba4ed2: Loading layer [==================================================>] 3.584kB/3.584kB
ee43eb3a3893: Loading layer [==================================================>] 12.29kB/12.29kB
Loaded image: goharbor/harbor-log:v2.2.0
45a339152b94: Loading layer [==================================================>] 6.779MB/6.779MB
Loaded image: goharbor/nginx-photon:v2.2.0
e6c87254655c: Loading layer [==================================================>] 4.926MB/4.926MB
385174b02cde: Loading layer [==================================================>] 5.926MB/5.926MB
427415aeb0cc: Loading layer [==================================================>] 13.33MB/13.33MB
a46c9a86420a: Loading layer [==================================================>] 27.36MB/27.36MB
0646903e30c4: Loading layer [==================================================>] 22.02kB/22.02kB
74c332a73d82: Loading layer [==================================================>] 13.33MB/13.33MB
Loaded image: goharbor/notary-signer-photon:v2.2.0
d6c1f4fe3f89: Loading layer [==================================================>] 4.932MB/4.932MB
da140a6b9c66: Loading layer [==================================================>] 62.71MB/62.71MB
014c145ecf1c: Loading layer [==================================================>] 3.072kB/3.072kB
73ad0cb1c27d: Loading layer [==================================================>] 4.096kB/4.096kB
4d442ea85017: Loading layer [==================================================>] 63.53MB/63.53MB
Loaded image: goharbor/chartmuseum-photon:v2.2.0
c8fae5121874: Loading layer [==================================================>] 77.48MB/77.48MB
3b920f9fa989: Loading layer [==================================================>] 54.62MB/54.62MB
f156b6b2a217: Loading layer [==================================================>] 2.56kB/2.56kB
906ca23bc04b: Loading layer [==================================================>] 1.536kB/1.536kB
12b8ebf41897: Loading layer [==================================================>] 18.43kB/18.43kB
6190944c245c: Loading layer [==================================================>] 4.058MB/4.058MB
e08cb3f4e745: Loading layer [==================================================>] 278.5kB/278.5kB
Loaded image: goharbor/prepare:v2.2.0
366e44984cdc: Loading layer [==================================================>] 6.779MB/6.779MB
eb1850e4d6ec: Loading layer [==================================================>] 9.096MB/9.096MB
ecaa0fbfe5ea: Loading layer [==================================================>] 1.691MB/1.691MB
Loaded image: goharbor/harbor-portal:v2.2.0
[Step 3]: preparing environment ...
[Step 4]: preparing harbor configs ...
prepare base dir is set to /opt/harbor
Traceback (most recent call last):
File "main.py", line 15, in <module>
cli()
File "/usr/lib/python3.6/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/usr/lib/python3.6/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/usr/lib/python3.6/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/lib/python3.6/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/usr/src/app/commands/prepare.py", line 37, in prepare
config_dict = parse_yaml_config(conf, with_notary=with_notary, with_trivy=with_trivy, with_chartmuseum=with_chartmuseum)
File "/usr/src/app/utils/configs.py", line 168, in parse_yaml_config
config_dict['data_volume'] = configs['data_volume']
KeyError: 'data_volume'
发现上文的报错后,发现harbor本身给提供了一个配置文件harbor.yml.tmpl,我们只需要修改此配置文件即可。
[root@linux-001 harbor]# mv harbor.yml harbor.yml.zdybak
[root@linux-001 harbor]#
[root@linux-001 harbor]# vim harbor.yml.tmpl
[root@linux-001 harbor]# cp harbor.yml.tmpl harbor.yml
[root@linux-001 harbor]# mkdir -p /data/harbor/
[root@linux-001 harbor]# sh install.sh
[Step 0]: checking if docker is installed ...
Note: docker version: 20.10.4
[Step 1]: checking docker-compose is installed ...
Note: docker-compose version: 1.28.5
[Step 2]: loading Harbor images ...
Loaded image: goharbor/harbor-jobservice:v2.2.0
Loaded image: goharbor/harbor-exporter:v2.2.0
Loaded image: goharbor/registry-photon:v2.2.0
Loaded image: goharbor/harbor-core:v2.2.0
Loaded image: goharbor/harbor-db:v2.2.0
Loaded image: goharbor/notary-server-photon:v2.2.0
Loaded image: goharbor/trivy-adapter-photon:v2.2.0
Loaded image: goharbor/harbor-registryctl:v2.2.0
Loaded image: goharbor/redis-photon:v2.2.0
Loaded image: goharbor/harbor-log:v2.2.0
Loaded image: goharbor/nginx-photon:v2.2.0
Loaded image: goharbor/notary-signer-photon:v2.2.0
Loaded image: goharbor/chartmuseum-photon:v2.2.0
Loaded image: goharbor/prepare:v2.2.0
Loaded image: goharbor/harbor-portal:v2.2.0
[Step 3]: preparing environment ...
[Step 4]: preparing harbor configs ...
prepare base dir is set to /opt/harbor
Generated configuration file: /config/portal/nginx.conf
Generated configuration file: /config/log/logrotate.conf
Generated configuration file: /config/log/rsyslog_docker.conf
Generated configuration file: /config/nginx/nginx.conf
Generated configuration file: /config/core/env
Generated configuration file: /config/core/app.conf
Generated configuration file: /config/registry/config.yml
Generated configuration file: /config/registryctl/env
Generated configuration file: /config/registryctl/config.yml
Generated configuration file: /config/db/env
Generated configuration file: /config/jobservice/env
Generated configuration file: /config/jobservice/config.yml
Generated and saved secret to file: /data/secret/keys/secretkey
Successfully called func: create_root_cert
Generated configuration file: /compose_location/docker-compose.yml
Clean up the input dir
[Step 5]: starting Harbor ...
Creating network "harbor_harbor" with the default driver
Creating harbor-log ... done
Creating redis ... done
Creating harbor-db ... done
Creating registry ... done
Creating harbor-portal ... done
Creating registryctl ... done
Creating harbor-core ... done
Creating nginx ... done
Creating harbor-jobservice ... done
? ----Harbor has been installed and started successfully.----
到此为止,我们的harbor已经安装完成了。可以查看下harbor都安装了那些镜像和容器
[root@linux-001 harbor]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
goharbor/chartmuseum-photon v2.2.0 7d2b0430a45d 5 days ago 165MB
goharbor/redis-photon v2.2.0 dab1804560b2 5 days ago 68.9MB
goharbor/trivy-adapter-photon v2.2.0 658abcdfe7e3 5 days ago 120MB
goharbor/notary-server-photon v2.2.0 5117cee34e76 5 days ago 101MB
goharbor/notary-signer-photon v2.2.0 5d8879c476a8 5 days ago 98.4MB
goharbor/harbor-registryctl v2.2.0 6833a758fcfb 5 days ago 128MB
goharbor/registry-photon v2.2.0 c5797c8f62f1 5 days ago 77.2MB
goharbor/nginx-photon v2.2.0 39fcd9da1a47 5 days ago 40.2MB
goharbor/harbor-log v2.2.0 27a38464bdcd 5 days ago 108MB
goharbor/harbor-jobservice v2.2.0 62b4ae79b159 5 days ago 163MB
goharbor/harbor-core v2.2.0 049ef19b7080 5 days ago 148MB
goharbor/harbor-portal v2.2.0 d9eff87cd8b5 5 days ago 51MB
goharbor/harbor-db v2.2.0 2f84c1cc9b71 5 days ago 174MB
goharbor/prepare v2.2.0 c632fc058adf 5 days ago 165MB
goharbor/harbor-exporter v2.2.0 700422c549b0 5 days ago 76.1MB
[root@linux-001 harbor]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7261d08f6c88 goharbor/harbor-jobservice:v2.2.0 "/harbor/entrypoint.…" 2 minutes ago Up 2 minutes (healthy) harbor-jobservice
410fead1f072 goharbor/nginx-photon:v2.2.0 "nginx -g 'daemon of…" 2 minutes ago Up 2 minutes (healthy) 0.0.0.0:80->8080/tcp, 0.0.0.0:443->8443/tcp nginx
bb91bc587d0c goharbor/harbor-core:v2.2.0 "/harbor/entrypoint.…" 2 minutes ago Up 2 minutes (healthy) harbor-core
4e39958881a8 goharbor/harbor-registryctl:v2.2.0 "/home/harbor/start.…" 2 minutes ago Up 2 minutes (healthy) registryctl
983f3c1e6934 goharbor/harbor-portal:v2.2.0 "nginx -g 'daemon of…" 2 minutes ago Up 2 minutes (healthy) harbor-portal
5cdc9899d947 goharbor/harbor-db:v2.2.0 "/docker-entrypoint.…" 2 minutes ago Up 2 minutes (healthy) harbor-db
7a364b296294 goharbor/registry-photon:v2.2.0 "/home/harbor/entryp…" 2 minutes ago Up 2 minutes (healthy) registry
b75781de0db5 goharbor/redis-photon:v2.2.0 "redis-server /etc/r…" 2 minutes ago Up 2 minutes (healthy) redis
8eea26eb3f49 goharbor/harbor-log:v2.2.0 "/bin/sh -c /usr/loc…" 2 minutes ago Up 2 minutes (healthy) 127.0.0.1:1514->10514/tcp harbor-log
由于我是在虚拟机测试的,所以需要修改windows的hosts文件,把刚才设置的域名解析到本地的虚拟机上。打开域名,即可访问到harbor。
通过使用账户admin,密码在harbor.yml文件中设置即可登录
创建了centos的项目,在创建项目的时候可以选择公开,也可以选择不公开,区别如下图。
创建开centos公开项目如下图。
在系统中登录私库harbor,并且传入私库镜像文件。
[root@linux-001 harbor]# docker login harbor.ideacome.com
Username: admin
Password:
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
[root@linux-001 harbor]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
goharbor/chartmuseum-photon v2.2.0 7d2b0430a45d 5 days ago 165MB
goharbor/redis-photon v2.2.0 dab1804560b2 5 days ago 68.9MB
goharbor/trivy-adapter-photon v2.2.0 658abcdfe7e3 5 days ago 120MB
goharbor/notary-server-photon v2.2.0 5117cee34e76 5 days ago 101MB
goharbor/notary-signer-photon v2.2.0 5d8879c476a8 5 days ago 98.4MB
goharbor/harbor-registryctl v2.2.0 6833a758fcfb 5 days ago 128MB
goharbor/registry-photon v2.2.0 c5797c8f62f1 5 days ago 77.2MB
goharbor/nginx-photon v2.2.0 39fcd9da1a47 5 days ago 40.2MB
goharbor/harbor-log v2.2.0 27a38464bdcd 5 days ago 108MB
goharbor/harbor-jobservice v2.2.0 62b4ae79b159 5 days ago 163MB
goharbor/harbor-core v2.2.0 049ef19b7080 5 days ago 148MB
goharbor/harbor-portal v2.2.0 d9eff87cd8b5 5 days ago 51MB
goharbor/harbor-db v2.2.0 2f84c1cc9b71 5 days ago 174MB
goharbor/prepare v2.2.0 c632fc058adf 5 days ago 165MB
goharbor/harbor-exporter v2.2.0 700422c549b0 5 days ago 76.1MB
[root@linux-001 harbor]# docker pull goharbor/nginx-photon:v2.2.0
v2.2.0: Pulling from goharbor/nginx-photon
Digest: sha256:ab96c8a6dbdaace47a504c78840eb56b23e0a7cd6d92e62284795887387f49ac
Status: Image is up to date for goharbor/nginx-photon:v2.2.0
docker.io/goharbor/nginx-photon:v2.2.0
[root@linux-001 harbor]# docker tag goharbor/nginx-photon:v2.2.0 harbor.ideacome.com/centos/goharbor/nginx-photon:v2.2.0
[root@linux-001 harbor]# docker push harbor.ideacome.com/centos/goharbor/nginx-photon:v2.2.0
The push refers to repository [harbor.ideacome.com/centos/goharbor/nginx-photon]
45a339152b94: Pushed
07ed3fe22282: Pushed
v2.2.0: digest: sha256:ab96c8a6dbdaace47a504c78840eb56b23e0a7cd6d92e62284795887387f49ac size: 740
这样在私库centos项目中就可以看到我们传入的镜像。
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有