离线安装harbor

1、docker-compose-linux-x86_64下载

mv docker-compose-linux-x86_64 /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
vim ~/.bashrc
# 在文件结尾加入
export PATH=/usr/local/bin:$PATH

source ~/.bashrc
docker-compose --version

2、harbor-offline-installer-v2.8.2.tgz下载下来

cp harbor.yml.tmpl harbor.yml
vim harbor.yml
1 hostname: 改成电脑的ip地址
2 注释掉这里的内容
#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 这里改成你的存储地址
# The default data volume
data_volume:

3 配置nginx是为了访问ip1就能访问到ip2

docker pull nginx:1.14.2
vim nginx.conf
user nginx;
worker_processes 1;

error_log /var/log/nginx/error.log warn;

pid /var/run/nginx.pid;

events {
  worker_connections 1024;
}

stream {
  upstream hub {
    server 192.168.1.6:80;  # 这个ip是ip1,这台nginx服务器的ip是ip2
  }
  server {
    listen 80;
    proxy_pass hub;
    proxy_timeout 300s;
    proxy_connect_timeout 5s;
  }
}

vim restart.sh

docker stop harbornginx

docker rm harbornginx

docker run -itd --net=host --name harbornginx -v /home/admin/nginx/nginx.conf:/etc/nginx/nginx.conf nginx:1.14.2

4 配置 /etc/hosts
所有机器的daemon.json要加上这句
“insecure-registries”: [“hub.example.com”],

5 在网页中新建项目,比如test,然后新建用户,再点开项目–成员,把新建用户加上
docker login hub.example.com 把新建用户信息填入

你可能感兴趣的:(storage,运维,linux)