上一章:二进制部署K8s集群第4节之docker环境安装
部署于HDSS7-200.host.com上
github下载地址:https://github.com/goharbor/harbor
一、下载软件解压
mkdir /src;cd /src
rz ==> harbor-offline-installer-v2.1.0.tgz
tar xf harbor-offline-installer-v2.1.0.tgz -C /opt/
cd /opt/
mv harbor/ harbor-v2.1.0
ln -s /opt/harbor-v2.1.0/ /opt/harbor
二、配置harbor.yml
cd /opt/harbor/
cp harbor.yml.tmpl harbor.yml
vi harbor.yml
5 hostname: harbor.od.com
10 port: 180
13 #https:
15 # port: 443
17 # certificate: /your/certificate/path
18 # private_key: /your/private/key/path
34 harbor_admin_password: Harbor12345
47 data_volume: /data/harbor
125 location: /data/harbor/logs
mkdir -p /data/harbor/logs
三、安装harbor
yum install docker-compose -y
sh /opt/harbor/install.sh
docker-compose ps
docker ps -a
四、安装配置Nginx
yum -y install nginx
cat > /etc/nginx/conf.d/harbor.od.com.conf <<eof
server {
listen 80;
server_name harbor.od.com;
client_max_body_size 1000m;
location / {
proxy_pass http://127.0.0.1:180;
}
}
eof
nginx -t
systemctl start nginx
systemctl enable nginx
curl harbor.od.com
五、浏览器访问
http://harbor.od.com
用户名:admin
密码:Harbor12345
六、创建公有项目
七、推送镜像到公有仓库
docker pull nginx:1.7.9 # 等价于docker pull docker.io/library/nginx:1.7.9
[root@hdss7-200 conf.d]# docker images | grep 1.7.9
nginx 1.7.9 84581e99d807 5 years ago 91.7MB
docker login harbor.od.com # 用户名admin,密码Harbor12345
docker tag 84581e99d807 harbor.od.com/public/nginx:v1.7.9
docker push harbor.od.com/public/nginx:v1.7.9
八、查看镜像