0%

搭建Docker私有仓库Harbor

官网:https://goharbor.io/
安装介绍:https://github.com/goharbor/harbor/blob/master/docs/installation_guide.md

系统要求

docker 17.03.0-ce +
docker-compose 1.10.0+

安装docker-compose

docker-compose安装:https://docs.docker.com/compose/install/

1
2
3
4
sudo curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

chmod +x /usr/local/bin/docker-compose
docker-compose --version

安装harbor

下载地址:https://github.com/goharbor/harbor/releases

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#下载的是offline离线包
wget https://storage.googleapis.com/harbor-releases/release-1.8.0/harbor-offline-installer-v1.8.1.tgz

#解压,配置harbor
tar zxvf harbor-offline-installer-v1.8.1.tgz
cd harbor/

#vim harbor.yml
hostname = 192.168.1.62

#安装
./install.sh

#Harbor的启动和停止
启动Harbor
# docker-compose start
停止Harbor
# docker-comose stop
重启Harbor
# docker-compose restart

#配置docker(https错误)
#vim /usr/lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd --insecure-registry=192.168.100.120
#只加上--insecure-registry这个参数即可

或者
创建/etc/docker/daemon.json文件,在文件中指定仓库地址
# cat > /etc/docker/daemon.json << EOF
{
"registry-mirrors": ["https://bv55mwyn.mirror.aliyuncs.com"],
"insecure-registries":["192.168.100.120"]
}
EOF
然后重启docker