2023年6月21日发(作者:)
详解基于Harbor搭建Docker私有镜像仓库什么是 Harbor?第⼀次使⽤这个的时候是刚进公司处理的第⼀个任务的时候,发现 Harbor 就是⼀个⽤于存储和分发 Docker 镜像的企业级Registry 服务器。⽹上找到⼀个 Harbor 的架构图:环境准备1、⾃⼰在腾讯云买的服务器(CentOS7.3)2、Docker 版本:17.05.0-ce3、Docker-compose:1.17.14、Harbor:1.1.2安装 Docker因为系统是 CentOS 7.3 ,内核啥的都已经是 3.10,所以不⽤担⼼内核升级的问题,⼀些操作啥的在 7.x 上操作也很⽅便。yum update //系统版本更新vim /etc/.d/ //添加以下内容[dockerrepo]name=Docker Repositorybaseurl=/repo/main/centos/7/enabled=1gpgcheck=1gpgkey=/gpg//下⾯安装 Docker 引擎yum install docker-engine -y//安装docker引擎,此步也可作为更新docker版本的操作:先#systemctl stop docker 停⽌docker服务,再#yum install docker-engine 更新docker版本systemctl enable esystemctl start docker //启动docker守护进程docker info //查看docker运⾏情况docker -v //查看版本信息修改 Docker 配置⽂件 /etc/default/docker 如下:复制代码 代码如下:DOCKER_OPTS="--registry-mirror=" //换成国内的镜像加速源,不然拉取镜像简直龟速,不想在吐槽了使⽤
service docker restart 重启 Docker 服务即可。或者⽤官⽅提供的⽅式:复制代码 代码如下:curl -sSL /daotools/set_ | sh -s [/code]安装 Docker-compose如果是想直接命令安装也⾏,下载指定版本的docker-compose对⼆进制⽂件赋可执⾏权限chmod +x /usr/local/bin/docker-compose测试下docker-compose是否安装成功docker-compose --version出现如下docker-compose version 1.17.1, build 6d101fb但是,这种⽅法简直龟速,幸好还有种⽅法,这种需要通过 Python 的 pip 安装安装 pipwget --no-check-certificate /packages/source/s/setuptools/ -vxf setuptools-1.4.2python2.7 install //因为服务器⾃带 Python 2.7easy_install-2.7 pip安装 docker composepip install docker-composedocker-compose --version //测试安装是否成功安装 Harborwget /vmware/harbor/releases/download/v1.1.2/#离线安装包,也是龟速,把这个下载链接⽤迅雷下载,速度却贼快,嘿嘿,然后再传到服务器上去,整个过程快很多!tar -zxvf 解压缩之后,进⼊⽬录下会看到 ⽂件,该⽂件就是 Harbor 的配置⽂件。## Configuration file of Harbor# hostname设置访问地址,可以使⽤ip、域名,不可以设置为127.0.0.1或localhosthostname = 115.159.227.249 #这⾥我先配置我的服务器IP地址# 访问协议,默认是http,也可以设置https,如果设置https,则nginx ssl需要设置onui_url_protocol = http# mysql数据库root⽤户默认密码root123,实际使⽤时修改下db_password = root123#Maximum number of job workers in job servicemax_job_workers = 3#Determine whether or not to generate certificate for the registry's token.#If the value is on, the prepare script creates new root cert and private key#for generating token to access the registry. If the value is off the default key/cert will be used.#This flag also controls the creation of the notary signer's ize_crt = on#The path of cert and key files for nginx, they are applied only the protocol is set to httpsssl_cert = /data/cert/_cert_key = /data/cert/#The path of secretkey storagesecretkey_path = /data#Admiral's url, comment this attribute, or set its value to NA when Harbor is standaloneadmiral_url = NA#NOTES: The properties between BEGIN INITIAL PROPERTIES and END INITIAL PROPERTIES#only take effect in the first boot, the subsequent changes of these properties#should be performed on web ui#************************BEGIN INITIAL PROPERTIES************************#Email account settings for sending out password resetting emails.#Email server uses the given username and password to authenticate on TLS connections to host and act as identity.#Identity left blank to act as _identity =email_server = il_server_port = 25email_username = sample_admin@il_password = abcemail_from = admin
2023年6月21日发(作者:)
详解基于Harbor搭建Docker私有镜像仓库什么是 Harbor?第⼀次使⽤这个的时候是刚进公司处理的第⼀个任务的时候,发现 Harbor 就是⼀个⽤于存储和分发 Docker 镜像的企业级Registry 服务器。⽹上找到⼀个 Harbor 的架构图:环境准备1、⾃⼰在腾讯云买的服务器(CentOS7.3)2、Docker 版本:17.05.0-ce3、Docker-compose:1.17.14、Harbor:1.1.2安装 Docker因为系统是 CentOS 7.3 ,内核啥的都已经是 3.10,所以不⽤担⼼内核升级的问题,⼀些操作啥的在 7.x 上操作也很⽅便。yum update //系统版本更新vim /etc/.d/ //添加以下内容[dockerrepo]name=Docker Repositorybaseurl=/repo/main/centos/7/enabled=1gpgcheck=1gpgkey=/gpg//下⾯安装 Docker 引擎yum install docker-engine -y//安装docker引擎,此步也可作为更新docker版本的操作:先#systemctl stop docker 停⽌docker服务,再#yum install docker-engine 更新docker版本systemctl enable esystemctl start docker //启动docker守护进程docker info //查看docker运⾏情况docker -v //查看版本信息修改 Docker 配置⽂件 /etc/default/docker 如下:复制代码 代码如下:DOCKER_OPTS="--registry-mirror=" //换成国内的镜像加速源,不然拉取镜像简直龟速,不想在吐槽了使⽤
service docker restart 重启 Docker 服务即可。或者⽤官⽅提供的⽅式:复制代码 代码如下:curl -sSL /daotools/set_ | sh -s [/code]安装 Docker-compose如果是想直接命令安装也⾏,下载指定版本的docker-compose对⼆进制⽂件赋可执⾏权限chmod +x /usr/local/bin/docker-compose测试下docker-compose是否安装成功docker-compose --version出现如下docker-compose version 1.17.1, build 6d101fb但是,这种⽅法简直龟速,幸好还有种⽅法,这种需要通过 Python 的 pip 安装安装 pipwget --no-check-certificate /packages/source/s/setuptools/ -vxf setuptools-1.4.2python2.7 install //因为服务器⾃带 Python 2.7easy_install-2.7 pip安装 docker composepip install docker-composedocker-compose --version //测试安装是否成功安装 Harborwget /vmware/harbor/releases/download/v1.1.2/#离线安装包,也是龟速,把这个下载链接⽤迅雷下载,速度却贼快,嘿嘿,然后再传到服务器上去,整个过程快很多!tar -zxvf 解压缩之后,进⼊⽬录下会看到 ⽂件,该⽂件就是 Harbor 的配置⽂件。## Configuration file of Harbor# hostname设置访问地址,可以使⽤ip、域名,不可以设置为127.0.0.1或localhosthostname = 115.159.227.249 #这⾥我先配置我的服务器IP地址# 访问协议,默认是http,也可以设置https,如果设置https,则nginx ssl需要设置onui_url_protocol = http# mysql数据库root⽤户默认密码root123,实际使⽤时修改下db_password = root123#Maximum number of job workers in job servicemax_job_workers = 3#Determine whether or not to generate certificate for the registry's token.#If the value is on, the prepare script creates new root cert and private key#for generating token to access the registry. If the value is off the default key/cert will be used.#This flag also controls the creation of the notary signer's ize_crt = on#The path of cert and key files for nginx, they are applied only the protocol is set to httpsssl_cert = /data/cert/_cert_key = /data/cert/#The path of secretkey storagesecretkey_path = /data#Admiral's url, comment this attribute, or set its value to NA when Harbor is standaloneadmiral_url = NA#NOTES: The properties between BEGIN INITIAL PROPERTIES and END INITIAL PROPERTIES#only take effect in the first boot, the subsequent changes of these properties#should be performed on web ui#************************BEGIN INITIAL PROPERTIES************************#Email account settings for sending out password resetting emails.#Email server uses the given username and password to authenticate on TLS connections to host and act as identity.#Identity left blank to act as _identity =email_server = il_server_port = 25email_username = sample_admin@il_password = abcemail_from = admin
发布评论