1.Harbor 简介
Harbor 是由 VMWare 公司开源的容器镜像仓库. 事实上, Harbor 是在 Docker Registry 上进行了相应的企业级扩展, 从而获得了更加广泛的应用, 这些新的企业级特性包括: 管理用户界面, 基于角色的访问控制, AD/LDAP 集成以及审计日志等, 足以满足基本企业需求.
2. 安装 docker-ce
1) 安装依赖包
[root@harbor opt]# yum install -y yum-utils device-mapper-persistent-data lvm2
2) 下载 docker-ce 仓库
[root@harbor opt]# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
官方比较慢的话, 可以使用阿里云的 docker-ce.repo
3) 更新仓库
yum repolist 或者 yum makecache fast
4) 安装 docker-ce
[root@harbor opt]# yum install docker-ce -y
5) 配置加速并启动
- [root@harbor opt]# curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io/
- [root@harbor opt]# systemctl start docker
6) 确认安装完成
[root@harbor opt]# docker version
3. 安装 docker-compose
第一种方式: yum 安装
[root@harbor opt]# yum install docker-compose -y
第二种方式: 下载可执行文件:
- [root@harbor opt]# curl -L "-s)-$(uname -m)" -o /usr/local/bin/docker-compose
- [root@harbor opt]# chmod +x /usr/local/bin/docker-compose
确认安装完成:
4. 安装 harbor
- [root@harbor opt]# cd /opt
- [root@harbor opt]# wget
- [root@harbor opt]# tar -xf harbor-offline-installer-v1.6.1.tgz
- [root@harbor opt]# cd harbor/
- [root@harbor opt]# VIM harbor.cfg
hostname = reg.slito.com \harbor 的服务地址 (ip 或者域名)
ui_url_protocol = http \ 选择 http 方式
harbor_admin_password = 123456 \harbor web 访问的密码
[root@harbor harbor]# ./prepare \ 加载配置
[root@harbor harbor]# ./install.sh \ 安装 harbor
安装完成后, 提示通过 "http://reg.slito.com/" 访问 harbor, 用户名是 admin, 密码是之前设置的 123456
5. 上传镜像到 harbor 仓库
在本机配置 harbor 仓库 http 可信
/etc/docker/daemon.JSON 中添加 ""insecure-registries":["reg.slito.com"]", 重启 docker
不然会报错, 默认是走 https 的
在 node1 上登录 harbor 仓库, 上传 / 下载镜像
- [root@node1 ~]# docker login reg.slito.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
来源: http://blog.51cto.com/slitobo/2323332