美文网首页
离线安装私有镜像仓库Harbor

离线安装私有镜像仓库Harbor

作者: 围着火炉切水果 | 来源:发表于2019-04-08 22:56 被阅读0次

1.安装docker

参考这里:https://www.jianshu.com/p/3557f35f22a7

2.安装docker compose

https://github.com/docker/compose/releases 下载docker-compose包

#将docker-compose包移动到/usr/local/bin并更名
mv docker-compose-Linux-x86_64 /usr/local/bin/docker-compose
#权限设置
sudo chmod +x /usr/local/bin/docker-compose
#查看版本
docker-compose –v

能够正常查看到docker-compose版本则安装成功

docker-compose version 1.22.0, build f46880fe

3.下载harbor

下载地址:http://harbor.orientsoft.cn/

4.解压

tar  -xzf harbor-offline-installer-0.5.0.tgz
cd  harbor

修改Harbor配置文件,设置hoastname
vi harbor.cfg

## Configuration file of Harbor
#This attribute is for migrator to detect the version of the .cfg file, DO NOT MODIFY!
_version = 1.5.0
#The IP address or hostname to access admin UI and registry service.
#DO NOT use localhost or 127.0.0.1, because Harbor needs to be accessed by external clients.
#这里设置本机IP
hostname = 192.168.0.128

5.修改配置文件

#创建配置文件:
vi /etc/sysconfig/docker
#加入如下内容:
OPTIONS="--insecure-registry 192.168.0.128" 

修改配置文件
vi /usr/lib/systemd/system/docker.service

#添加下面两行内容:
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
EnvironmentFile=-/etc/sysconfig/docker
ExecStart=/usr/bin/dockerd $OPTIONS

重启使配置生效

systemctl daemon-reload
systemctl restart docker

6.运行harbor

./prepare
./install.sh

安装成功后,会给出访问路径


安装完成

安装完成,登陆网页管理界面:192.168.0.128,默认用户名:admin 密码:Harbor12345


登录界面

7.上传镜像到harbor

通过docker images命令可以查看当前有哪些镜像


镜像列表

将镜像打上标记,以hello-world为例

docker tag hello-world 192.168.0.128/library/hello-world

上传镜像

docker push 192.168.0.128/library/hello-world

上传完成后,后续即可从Harbor拉取镜像
备注:第一次向仓库上传镜像可能会失败,需要先使用docker login登录当前仓库

8.初始化harbor

若Harbor安装过程中出现异常,可对环境初始化

 cd /opt/docker/harbor
 docker-compose stop
 docker-compose rm
 rm -rf /data/database
 rm -rf /data/registry

8.离线安装包

相关文章

网友评论

      本文标题:离线安装私有镜像仓库Harbor

      本文链接:https://www.haomeiwen.com/subject/aaimiqtx.html