Harbor镜像仓库的安装与配置

一、安装并启动docker

​ 1. 安装docker-ce,略...

​ 2. 安装docker-compose

curl -L "https://github.com/docker/compose/releases/download/1.25.0/docker-compose-Linux-x86_64" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose --version
二、配置安装harbor

​ 1. Harbor软件包下载地址:https://github.com/goharbor/h...

mkdir /data1/srv/ -p
cd /data1/srv
wget https://github.com/goharbor/harbor/releases/download/v1.10.4/harbor-offline-installer-v1.10.4.tgz
tar -zxvf harbor-offline-installer-v1.10.4.tgz

​ 2. 编辑harbor.yml配置

vim harbor.yml #编辑harbor的配置文件,按需修改以下内容
    hostname = 192.168.1.242
    port: 80
    harbor_admin_password = admin #harbor的admin用户的密码
    data_volume: /harbor/data    #harbor存储位置

​ 3. 执行安装脚本进行安装

./prepare #配置Harbor
./install.sh #安装Harbor

安装启动完成后可在浏览器进行访问登录测试

​ 4. 修改docker配置文件,使其支持harbor

vim /etc/docker/daemon.json
{
"insecure-registries": [ "192.168.1.228" ]
}

​ 5. 保存配置后重启docker

systemctl restart docker
三、配置Harbor的开机自启

​ 1. 在 /lib/systemd/system/harbor.service 中写入以下内容

[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
#需要注意harbor的安装位置
ExecStart=/usr/local/bin/docker-compose -f  /data1/srv/harbor/docker-compose.yml up
ExecStop=/usr/local/bin/docker-compose -f /data1/srv/harbor/docker-compose.yml down    

[Install]
WantedBy=multi-user.target
    systemctl enable harbor        #设置harbor开机自启
    systemctl start harbor        #启动harbor

​ 注意:如果更改了harbor.yml文件,必须要重新执行install脚本,或者执行./prepare脚本,生成新的配置文件

你可能感兴趣的:(镜像,容器,docker)