Centos版的安装docker-registry私有仓库
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Centos版的安装docker-registry私有仓库相关的知识,希望对你有一定的参考价值。
①# yum groupinstall -y "Development Tools"
# yum -y install epel-release #需要安装python-pip的扩展源
# yum -y install python-dev* libevent-dev* python-pip* openssl-devel xz-devel libffi-dev*
# [[email protected] ~]# git clone https://github.com/docker/docker-registry.git
Cloning into 'docker-registry'...
remote: Counting objects: 7007, done.
remote: Total 7007 (delta 0), reused 0 (delta 0), pack-reused 7007
Receiving objects: 100% (7007/7007), 1.69 MiB | 334.00 KiB/s, done.
Resolving deltas: 100% (4099/4099), done.
# cd docker-registry
# ls
ADVANCED.md CHANGELOG.md config CONTRIBUTING.md depends docker_registry FAQ.md MANIFEST.in requirements setup.cfg tests AUTHORS circle.yml contrib DEBUGGING.md Dockerfile DRIVERS.md LICENSE README.md scripts setup.py tox.ini
② 然后基于样例创建配置文件:
# cp config/config_sample.yml config/config.yml
修改local模版段的storage_path到本地的存储仓库的路径,例如:/tmp/registry更改为/opt/data/registry。
# vi config/config.yml
......
local: &local
<<: *common
storage: local
storage_path: _env:STORAGE_PATH:/opt/data/registry
......
③ 需要安装M2Crypto RSA加密、解密
1.手动安装 M2Crypto 0.22.3
# wget https://pypi.python.org/packages/source/M/M2Crypto/M2Crypto-0.22.3.tar.gz #下载源码
# tar zxvf M2Crypto/M2Crypto-0.22.3.tar.gz # 解压
# cd M2Crypto-0.22.3
2. 然后创建安装脚本,内容如下:
# vim fedora_setup.sh
#!/bin/sh
# This script is meant to work around the differences on Fedora Core-based# distributions (Redhat, CentOS, ...) compared to other common Linux
# distributions.
#
# Usage: ./fedora_setup.sh [setup.py options]
#
arch=`uname -m`
for i in SWIG/_{ec,evp}.i; do
sed -i -e "s/opensslconf\./opensslconf-${arch}\./" "$i"
done
SWIG_FEATURES=-cpperraswarn python setup.py $*
3. 然后为脚本添加执行权限,执行脚本,并安装M2Crypto 0.22.3
# chmod +x fedora_setup.sh
# ./fedora_setup.sh build
# python setup.py install
# echo $? #返回值为0,则安装成功
解决方法是在docker的配置文件里面OPTIONS添加 –insecure-registry http://10.0.0.10:5000 选项
# /etc/sysconfig/docker
# Modify these options if you want to change the way the docker daemon runs
OPTIONS='--selinux-enabled --insecure-registry 10.0.0.10:5000'
DOCKER_CERT_PATH=/etc/docker
然后重启docker服务:
OPTIONS='--selinux-enabled --insecure-registry 10.0.0.10:5000'
DOCKER_CERT_PATH=/etc/docker
④ 然后执行安装操作:
# python setup.py install
# echo $? #返回值为0,则安装成功
对于通过软件包方式安装的,配置文件一般需要放在
/usr/local/lib/python2.7/dist-packages/docker_registry/config/cpnfig.yml
⑤ 此时,可以通过下面的命令来启动(nohup commend &; jobs -l查看进程):
# gunicorn --access-logfile /var/log/docker-registry/access.log --error-logfile /var/log/docker-registry/server.log -k gevent --max-requests 100 --graceful-timeout 3600 -t 3600 -b 127.0.0.1:5000 -w 1 docker_registry.wsgi:application
# curl 127.0.0.1:5000
⑥ 配置服务脚本:
一般通过服务脚本来管理registry服务会更加方便,以centos系统为例:
以上是关于Centos版的安装docker-registry私有仓库的主要内容,如果未能解决你的问题,请参考以下文章
docker私有仓库yum安装 docker-registry