Harbor是一个开源可信云本地注册表项目,用于存储、签名和扫描内容。Harbor通过添加安全、标识和管理等用户通常需要的功能,扩展了开源Docker发行版。让注册表更接近构建和运行环境可以提高图像传输效率。Harbor支持在注册中心之间复制映像,还提供高级安全特性,如用户管理、访问控制和活动审计。
前提:Linux主机上 docker 17.03.0-ce+ and docker-compose 1.10.0+ .
1 下载harbor安装文件
# 下载文件
wget https://storage.googleapis.com/harbor-releases/release-1.7.0/harbor-offline-installer-v1.7.4.tgz
# 安装
tar xvf harbor-offline-installer-v1.7.4.tgz
2 修改harbor配置文件
vim harbor.cfg
# 设置访问地址 不能为localhost和127.0.0.1
hostname = 192.168.124.16
# 启动Harbor后,管理员UI登录的密码,默认是Harbor12345
harbor_admin_password = Harbor12345
3 启动harbor
./install.sh 或 docker-compose.yml start
4 查看是否启动
[root@localhost harbor]# docker-compose psName Command State Ports
-------------------------------------------------------------------------------------------------------------------------------------
harbor-adminserver /harbor/start.sh Up (healthy)
harbor-core /harbor/start.sh Up (healthy)
harbor-db /entrypoint.sh postgres Up (healthy) 5432/tcp
harbor-jobservice /harbor/start.sh Up
harbor-log /bin/sh -c /usr/local/bin/ ... Up (healthy) 127.0.0.1:1514->10514/tcp
harbor-portal nginx -g daemon off; Up (healthy) 80/tcp
nginx nginx -g daemon off; Up (healthy) 0.0.0.0:443->443/tcp, 0.0.0.0:4443->4443/tcp, 0.0.0.0:80->80/tcp
redis docker-entrypoint.sh redis ... Up 6379/tcp
registry /entrypoint.sh /etc/regist ... Up (healthy) 5000/tcp
registryctl /harbor/start.sh Up (healthy)
访问下刚才配置的hostname 默认为80端口
账号为admin 密码默认为Harbor12345
5 使用docker将镜像push上去
vim /usr/lib/systemd/system/docker.service# 添加 注册地址 --insecure-registry 192.168.124.16
ExecStart=
ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock --insecure-registry 192.168.124.16
打个redis:test 标签上传看看
[root@localhost harbor]# docker tag redis:alpine 192.168.124.16/library/redis:test
[root@localhost harbor]# docker push 192.168.124.16/library/redis:test
The push refers to repository [192.168.124.16/library/redis]
78a899190ed6: Pushed
a9ed4dae6a82: Pushed
42d36aa9d127: Pushed
abd36062f9fe: Pushed
53b9ee4aa890: Pushed
bcf2f368fe23: Pushed
test: digest: sha256:aab00a77717131127e55e906a1355f0f94fd89a2a89fa5045e7b26d8aece268d size: 1572
上传成功!
Time the study pain is temporary, has not learned the pain is life-long.