Harbor部署私有镜像仓库
认识:
Harbor 是一个用于存储和分发 Docker 镜像的企业级 Registry 服务器。
部署环境:
- CentOS7
- Python2.7.5
- Docker CE18.09.6
- Docker Compose1.32.2
- Harbor1.7.1
安装:
- 安装组件
yum -y install wget python-devel libevent-devel epel-release python-pip gcc gcc-c++ xz-devel
- 安装Dcoker CE
yum install -y yum-utils device-mapper-persistent-data lvm2yum-config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repoyum -y install docker-ce
- 安装Dcoker compose
curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-composechmod +x /usr/local/bin/docker-compose
- 安装Harbor
cd /usr/local/srcwget https://storage.googleapis.com/harbor-releases/release-1.7.0/harbor-offline-installer-v1.7.1.tgz# 解压缩到目录/usr/local/harbortar -xvf harbor-offline-installer-v1.7.1.tgz -C /usr/local/
- 编辑配置文件
cd /usr/local/harbor/vi harbor.cfg'''hostname = test.harbor.comproject_creation_restriction = adminonly'''
- 安装服务
./install.sh
- 启动服务
docker-compose start
- 配置HTTPS
# 创建目录mkdir -p /data/cert/# 生成ca证书和签名openssl genrsa -out /data/cert/ca.key 2048openssl req -x509 -new -nodes -key /data/cert/ca.key -subj "/CN=test.harbor.com" -days 5000 -out /data/cert/ca.crt# 编辑配置文件vi harbor.cfgui_url_protocol = https# 启动服务./preparedocker-compose downdocker-compose up -d
- 测试
windows:
# 配置文件位置C:\Windows\System32\drivers\etc\hosts# 添加一行内容ip servername
ubuntu:
# 配置文件位置/etc/hosts# 添加一行内容ip servername
- 访问
# 在浏览器中访问https://test.harbor.com/默认用户名:admin默认密码:Harbor12345