原创

harbor部署

harbor

一、docker部署

Harbor是一个用于存储和分发Docker镜像的企业级Registry服务器,可以用来构建企业内部的Docker镜像仓库。

1.卸载旧的版本
yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine
2.安装需要的包
yum install -y yum-utils
3.设置镜像仓库
yum-config-manager \
    --add-repo \
    http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
4.更新yum软件包索引
yum makecache fast
5.安装docker
yum -y install docker-ce-20.10.* docker-ce-cli-20.10.* containerd.io
docker-ce	#社区版
#安装完成后验证
docker version
6.阿里云镜像加速
mkdir -p /etc/docker

tee /etc/docker/daemon.json <<-'EOF'
{
  	"registry-mirrors": ["https://axvfsf7e.mirror.aliyuncs.com"]
}
EOF
#启动
systemctl daemon-reload
systemctl start docker
systemctl enable docker
7.docker-compose安装
#官网下载
https://docs.docker.com/compose/install
#安装
curl -L https://github.com/docker/compose/releases/download/v2.5.0/docker-compose-linux-x86_64 -o usr/local/bin/docker-compose
#授权
chmod +x /usr/local/bin/docker-compose
#测试安装
docker-compose version
#卸载
rm -f /usr/local/bin/docker-compose

二、部署harbor

1.下载harbor安装文件
#创建harbor包存放目录
mkdir -p /opt/soft/harbor && cd /opt/soft/harbor
#下载地址
wget https://github.com/goharbor/harbor/releases/download/v1.10.10/harbor-online-installer-v1.10.10.tgz
#解压
tar -zxf harbor-online-installer-v1.10.10.tgz
2.配置harbor
#进入解压后的包
cd /opt/soft/harbor/harbor
vim harbor.yml
#配置文件harbor.yml详解
# Configuration file of Harbor
 
# 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: 机器ip地址或域名
 
# 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:
  # 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

3.启动Harbor
./install.sh
#Harbor依赖的镜像及启动服务查看
docker-compose ps
#访问
http://ip:prot

harbor
  • 作者:shi(联系作者)
  • 发表时间:2024-07-12 20:50:15
  • 版权声明:自由转载-非商用-非衍生-保持署名(创意共享3.0许可证)
  • 公众号转载:请在文末添加作者公众号二维码
  • 评论