下载harbor
# wget https://storage.googleapis.com/harbor-releases/release-1.8.0/harbor-offline-installer-v1.8.0.tgz
部署安装compose
# curl -L https://github.com/docker/compose/releases/download/1.22.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
# chmod +x /usr/local/bin/docker-compose
# tar xf harbor-offline-installer-v1.8.0.tgz
http访问方式配置
# cd harbor
# vim harbor.yml // 主机名要可以解析(需要部署dns服务器,用/etc/hosts文件没有用),如果不可以解析,可以使用IP地址,需要修改的内容如下
hostname: 192.168.85.99 主机IP地址
# sh install.sh
浏览器访问:http://192.168.85.99
可以注册账号,或者使用默认密码
客户端配置(每个访问harbor的机器上需要配置)
# vim /etc/docker/daemon.json
{
"insecure-registries": ["192.168.85.99"]
}
# systemctl restart docker
上传
# docker login 192.168.85.99 ip地址或者域名
Username: admin
Password:Harbor12345 或者使用自己创建的用户名密码
# docker images 查看镜像
# docker pull daocloud.io/library/nginx 拉取nginx镜像
# docker image tag daocloud.io/library/nginx 192.168.85.99/library/nginx:v1
# docker push 192.168.85.99/library/nginx:v1
https 访问方式的配置
#mkdir -pv /data/cert/
#openssl genrsa -out /data/cert/server.key 2048
#openssl req -x509 -new -nodes -key /data/cert/server.key -subj "/CN=192.168.85.99" -days 3650 -out /data/cert/server.crt
# ll -a /data/cert
修改配置文件
# vim harbor.yml
https:
port: 443
certificate: /data/cert/server.crt
private_key: /data/cert/server.key
应用配置并重起服务
# bash prepare
# docker-compose down
# docker-compose up -d
客户端配置*(每个访问harbor的机器上需要配置)
# vim /etc/docker/daemon.json
{
"insecure-registries": ["192.168.85.99"]
}
# systemctl restart docker
上传
# docker login 192.168.85.99 ip地址或者域名
Username: admin
Password:Harbor12345 或者使用自己创建的用户名密码
# docker images 查看镜像
# docker pull daocloud.io/library/nginx 拉取nginx镜像
# docker image tag daocloud.io/library/nginx 192.168.85.99/library/nginx:v1
# docker push 192.168.85.99/library/nginx:v1