部署Harbor仓库
下载docker
配置阿里云Docker Yum源
# yum install -y yum-utils device-mapper-persistent-data lvm2 git
# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
# yum install docker-ce -y
启动Docker服务:
#systemctl enable docker
#systemctl start docker
查看docker版本状态:
# docker -v
Docker version 1.13.1, build 8633870/1.13.1
# docker version
Client:
Version: 18.09.0
API version: 1.39
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:48:22 2018
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 18.09.0
API version: 1.39 (minimum version 1.12)
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:19:08 2018
OS/Arch: linux/amd64
Experimental: false
1.下载(wing用的1.8.0版本的harbor)
# wget https://storage.googleapis.com/harbor-releases/release-1.8.0/harbor-offline-installer-v1.8.0.tgz
# tar xf harbor-offline-installer-v1.8.0.tgz
# yum -y install lrzsz
2.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 (授权限)
# cd harbor
3.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.1.200" -days 3650 -out /da# ll -a /data/cert (主机IP)
# vim harbor.yml
hostname: 192.168.1.200
https:
port: 443
certificate: /data/cert/server.crt
private_key: /data/cert/server.key
4.应用配置并重起服务
# sh prepare
# docker-compose down
# docker-compose up -d
浏览器https方式测试:
5.客户端配置(每个访问harbor的机器上都要配置)
客户端配置文件:
# vim /etc/docker/daemon.json
{
"insecure-registries": ["172.22.211.175"]
}
# systemctl restart docker(重启)
创建仓库:
创建账户:
项目授权:
1.点击 项目名称
2.点击 成员 标签
3.点击 “+用户” 标签
上传:
[root@docker ~]# docker login harbor.io
Username: wing
Password:
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
# docker image tag daocloud.io/library/nginx:latest 172.22.211.175/jenkins/nginx(打标签)
# docker push 172.22.211.175/jenkins/nginx(推送)
在web界面中查看镜像是否被上传到仓库中