软件环境
Software | Version |
---|---|
Docker engine | version 17.06.0-ce+ 或者更高 |
Docker Compose | version 1.18.0 或者更高 |
Openssl | 最好是最新的 |
安装Docker(略)
安装openssl(略)
安装Docker Compose
推荐使用pip安装docker-compose,因为pip可以为你自动对应版本问题
安装pip
1 | yum -y install epel-release |
确认版本
1 | pip --version |
更新pip
1 | pip install --upgrade pip |
配置pip国内地址
临时使用
可以在使用pip的时候加参数-i https://pypi.tuna.tsinghua.edu.cn/simple
例如:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple docker-compose
,这样就会从清华这边的镜像去安装docker-compose。
永久修改,一劳永逸
Linux下,修改~/.pip/pip.conf
(没有就创建一个文件夹及文件。文件夹要加“.”,表示是隐藏文件夹)
内容如下:
1 | [global] |
安装docker-compose
1 | pip install docker-compose |
查看版本
1 | docker-compose version |
安装Harbor
下载Harbor离线安装文件
1 | wget https://storage.googleapis.com/harbor-releases/release-1.9.0/harbor-offline-installer-v1.9.1.tgz |
解压
1 | tar xvf harbor-offline-installer-v1.9.1.tgz |
修改配置文件
1 | cd harbor/ |
修改
1 | hostname = 192.168.0.2 |
这里只是简单的测试,所以只编辑这一行,其他的默认不做修改;可根据实际情况做修改!
配置docker私有仓库
因为docker默认使用的是https连接,而harbor默认使用http连接,所以需要修改docker配置标志insecure registry
不安全仓库的主机。当然,harbor也可以设置为https
添加私有仓库地址
1 | cat << EOF >>/etc/docker/daemon.json |
重启docker
1 | systemctl daemon-reload |
启动harbor
1 | ./instsall.sh |
安装Notary
要安装带有Notary服务的Harbor,请在运行时添加一个参数 install.sh
:
1 | ./install.sh --with-notary |
Note: 对于安装 Notary 这个参数 ui_url_protocol必须设置为 “https”. 要配置HTTPS,请参考以下部分.
更多关于Notary和Docker内容信任的信息,请参考 Docker’s documentation.
安装Clair
安装带有Clair service,添加参数当运行 install.sh
:
1 | ./install.sh --with-clair |
有关Clair的更多信息,请参阅Clair的文档
使用chart仓库
安装带有chart仓库服务的Harbor, 添加参数当你运行install.sh
:
1 | ./install.sh --with-chartmuseum |
Note:如果你都想安装Notary, Clair and chart repository service, 你必须同时指定
1 | ./install.sh --with-notary --with-clair --with-chartmuseum |
会拉取好几个镜像下来,及检查环境:
✔ —-Harbor has been installed and started successfully.—-
Now you should be able to visit the admin portal at https://harbor.qmerry.com.
For more details, please visit https://github.com/vmware/harbor .
到这里基本就安装成功了!
安装完成后会生成如下6个容器:
1 | docker ps |
6、验证
打开浏览器访问:http://192.168.0.2
登录私有仓库
1 | docker login 192.168.0.2 |
Login Succeeded