harbor 搭建
详细请看另一篇https://www.cnblogs.com/outsrkem/p/12597759.html
环境
CentOS 7.4
harbor-v1.9.1
底层需求
Python 应该是 2.7 或更高版本
Docker 引擎应为 1.10 或更高版本
Docker Compose 需要为 17.06.0+ 或更高版本
安装 docker-compose 命令或者直接导入命令到 /usr/local/bin/
curl -L https://github.com/docker/compose/releases/download/1.25.0/docker-compose-`uname -s`-`uname -m`
-o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
修改主机名
hostnamectl set-hostname harbor.hub.com
下载harbor
wget https://github.com/goharbor/harbor/releases/download/v1.9.3/harbor-offline-installer-v1.9.3.tgz
创建证书
mkdir -p /home/harbor/certs
cd /home/harbor
openssl req
-newkey rsa:4096 -nodes -sha256 -keyout certs/domain.key
-x509 -days 365 -out certs/domain.crt
-subj /C=CN/ST=BJ/L=BJ/O=DEVOPS/CN=harbor.hub.com
# Be sure to use the name myregistrydomain.com as a CN.
修改配置
# 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.
hostname: harbor.hub.com # 此处修改
# http related config
#http: # 此处修改
# port for http, default is 80. If https enabled, this port will redirect to https port
# port: 80 # 此处修改
# https related config
https: # 此处修改
# # https port for harbor, default is 443
port: 443 # 此处修改
# # The path of cert and key files for nginx
certificate: /home/harbor/certs/domain.crt # 此处修改
private_key: /home/harbor/certs/domain.key # 此处修改
······
# The default data volume
data_volume: /home/harbor/data # 此处修改
······
启动harbor
./install.sh
访问
https://harbor.hub.com 设置 hosts 映射文件。默认管理员用户名 / 密码为 admin / Harbor12345
指定镜像仓库地址
vim /etc/docker/daemon.json
{
"insecure-registries": ["harbor.hub.com"]
}
下载测试镜像
docker pull hello-world
给镜像重新打标签
docker tag hello-world:latest harbor.hub.com/library/word:latest
docker login harbor.hub.com -uadmin -pHarbor12345
docker push harbor.hub.com/library/word:latest