harbor服务安装
简介
Harbor 是为企业用户设计的容器镜像仓库开源项目,包括了权限管理(RBAC)、LDAP、审计、安全漏洞扫描、镜像验真、管理界面、自我注册、HA 等企业必需的功能,同时针对中国用户的特点,设计镜像复制和中文支持等功能。
安装docker
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sudo yum makecache fast
sudo yum -y install docker-ce
安装Docker Compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
安装 Harbor
wget https://github.com/goharbor/harbor/releases/download/v2.4.1/harbor-offline-installer-v2.4.1.tgz
tar zxvf harbor-offline-installer-v2.4.1.tgz
cd harbor
cp harbor.yml.tmpl harbor.yml
vi harbor.yml
修改地址
hostname: reg.mydomain.com
hostname: 104.207.128.221
禁用 HTTPS
#https:
# # https port for harbor, default is 443
# port: 443
# # The path of cert and key files for nginx
# certificate: /your/certificate/path
# private_key: /your/private/key/path
修改密码
harbor_admin_password: Harbor12345
运行 ./install.sh
设置开机启动
cat >/usr/lib/systemd/system/harbor.service <<EOF
[Unit]
Description=harbor
After=docker.service systemd-networkd.service systemd-resolved.service
Requires=docker.service
Documentation=http://github.com/vmware/harbor
[Service]
Type=simple
Restart=on-failure
RestartSec=5
ExecStart=/usr/local/bin/docker-compose -f /root/harbor/docker-compose.yml up
ExecStop=/usr/local/bin/docker-compose -f /root/harbor/docker-compose.yml down
[Install]
WantedBy=multi-user.target
EOF
systemctl enable harbor.service
推送到Harbor
vi /etc/docker/daemon.json
{
"insecure-registries": [
"104.207.128.221"
]
}
systemctl restart docker
登录
docker login -u admin -p Harbor12345 104.207.128.221
标签
docker tag de27f502653d 104.207.128.221/ceshi/ucenter:1.0.0
推送
docker push 104.207.128.221/ceshi/ucenter:1.0.0