ituser - 小小IT人遨游大大IT界

部署docker镜像私有仓库Harbor

2020-06-23 09:31:19 203次浏览


部署harbor  2.0
#################################
安装docker
centos 7.6
yum update
yum install -y yum-utils
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
#yum list docker-ce --showduplicates|sort -r #检查支持的版本
yum install docker-ce-17.06.2.ce-1.el7.centos
#yum install docekr
systemctl start docker
systemctl enable docker
yum install docker-compose
更改docker源
vi /etc/docker/daemon.json
{
    "registry-mirrors": ["http://hub-mirror.c.163.com"]
}
systemctl restart docker
#################################
压缩包
https://github.com/goharbor/harbor/releases
2.0版本
https://github.com/goharbor/harbor/releases/download/v2.0.0/harbor-offline-installer-v2.0.0.tgz
#################################
解压
tar -zxvf harbor-offline-installer-v1.7.1.tgz
cd harbor
cp harbor.yml.tmpl harbor.yml
vi harbor.yml
hostname: 你的IP
制作签名
cd ..
mkdir crt
openssl req -newkey rsa:4096 -nodes -sha256 -keyout ca.key -x509 -days 365 -out ca.crt
  Country Name (2 letter code) [XX]:HN
  State or Province Name (full name) []:zhengzhou
  Locality Name (eg, city) [Default City]:
  Organization Name (eg, company) [Default Company Ltd]:
  Organizational Unit Name (eg, section) []:cn
  Common Name (eg, your name or your server's hostname) []:ituser
  Email Address []:4099366@qq.com
openssl req -newkey rsa:4096 -nodes -sha256 -keyout 你的域名.key -out 你的域名.csr
  Country Name (2 letter code) [XX]:HN
  State or Province Name (full name) []:zhengzhou
  Locality Name (eg, city) [Default City]:
  Organization Name (eg, company) [Default Company Ltd]:
  Organizational Unit Name (eg, section) []:cn
  Common Name (eg, your name or your server's hostname) []:ituser
  Email Address []:4099366@qq.com
  Please enter the following 'extra' attributes
  to be sent with your certificate request
  A challenge password []:ituser
  An optional company name []:ituser
openssl x509 -req -days 365 -in 你的域名.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out 你的域名.crt
编辑harbor.yml
/home/work/harbor/package/crt
  https:
    # https port for harbor, default is 443
    port: 443
    # The path of cert and key files for nginx
    certificate: /home/work/harbor/package/crt/你的域名.crt
    private_key: /home/work/harbor/package/crt/你的域名.key
#默认账号是 admin 密码 Harbor12345
sh install.sh
harbor修改配置文件后重启
docker-compose down
./prepare
docker-compose up -d
######################################################
启动docker报错:To force a start use "systemctl reset-failed docker.service"报错解决办法  
vi /etc/docker/daemon.json
{"storage-driver":"devicemapper"}
Error response from daemon: Get https://192.168.153.129:5000/v2/: http: server gave HTTP response to
vi /etc/docker/daemon.json
"insecure-registries":["你的域名"]
说明

所有内容来及个人经验和互联网摘取,如有雷同纯属巧合,如有冒犯,欢迎留言,分享即快乐,感谢互联网中每一位懂得分享的ituser!QQ群:127331971(备注:ituser.cn)