使用vmware开源的registry管理工具Harbor作为镜像仓库,因其搭建依赖于docker-compose,所以不能用以上方法安装docker,配置方式如下。###安装docker:$ cur
使用vmware开源的registry管理工具Harbor作为镜像仓库,因其搭建依赖于docker-compose,所以不能用以上方法安装docker,配置方式如下。###安装docker:
$ curl -sSL https://get.docker.com | sh
###安装docker-compose:
$ curl -L "https://github.com/docker/compose/releases/download/1.8.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
###获取harbor:可以从发行页面下载安装程序的二进制文件。选择在线或离线安装程序。使用tar命令来提取包。
在线安装: $ wget https://github.com/vmware/harbor/releases/download/0.5.0/harbor-online-installer-0.5.0.tgz $ tar xvf harbor-online-installer-<version>.tgz离线安装程序: $ wget https://github.com/vmware/harbor/releases/download/0.5.0/harbor-offline-installer-0.5.0.tgz $ tar xvf harbor-offline-installer-<version>.tgz
###修改配置文件harbor.cfg :
$ vim harbor.cfg## 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 = registry.inzwc.com#The protocol for accessing the UI and token/notification service, by default it is http.#It can be set to https if ssl is enabled on nginx.ui_url_protocol = http#Email account settings for sending out password resetting emails.email_server = smtp.mydomain.comemail_server_port = 25email_username = [email protected]_password = abcemail_from = admin <[email protected]>##The password of Harbor admin, change this before any production use.harbor_admin_password= zwc123##By default the auth mode is db_auth, i.e. the credentials are stored in a local database.#Set it to ldap_auth if you want to verify a user's credentials against an LDAP server.auth_mode = db_auth#The url for an ldap endpoint.ldap_url = ldaps://ldap.mydomain.com#The basedn template to look up a user in LDAP and verify the user's password.ldap_basedn = uid=%s,ou=people,dc=mydomain,dc=com#The password for the root user of mysql db, change this before any production use.db_password = root123#Turn on or off the self-registration featureself_registration = on#####
###完成安装并启动Harbor
$ sudo ./install.sh
###启停harbor服务(必须与docker -compose.yml在同一目录中运行)
$ cd /root/harbor#停止harbor服务$ sudo docker-compose stopStopping nginx ... doneStopping harbor-jobservice ... doneStopping harbor-ui ... doneStopping harbor-db ... doneStopping registry ... doneStopping harbor-log ... done#重新启动harbor服务$ sudo docker-compose startStarting log ... doneStarting ui ... doneStarting mysql ... doneStarting jobservice ... doneStarting registry ... doneStarting proxy ... done#修改Harbor配置,请首先停止现有的Harbor实例,更新harbor.cfg,然后再次运行install.sh:$ sudo docker-compose down$ vim harbor.cfg$ sudo install.sh#删除harbor容器,同时保留图像数据和Harbor的数据库文件在文件系统上:$ sudo docker-compose down#删除harbor容器和数据(为了干净的重新安装)$ rm -r / data / database$ rm -r / data / registry#登录管理员门户并创建一个新的项目,例如myproject。然后,您可以使用docker命令登录和推送图像(默认情况下,注册表服务器侦听端口80):Log in to the admin portal and create a new project, e.g. myproject. You can then use docker commands to login and push images (By default, the registry server listens on port 80):$ docker login reg.test.com$ docker push reg.test.com/myproject/myrepo:mytag
参看文档:https://github.com/vmware/harbor/blob/master/docs/installation_guide.md