docker仓库存储后端使用glusterfs
环境
192.168.0.206 glusterfs1
192.168.0.228 glusterfs2
192.168.0.193 glusterfs3
192.168.0.220 docker-registry
系统
Centos 7
Glusterfs1-3配置
编辑/etc/hosts文件,添加如下内容,相互解析
192.168.0.206 glusterfs1
192.168.0.228 glusterfs2
192.168.0.193 glusterfs3
安装yum源
rpm -ivh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
2.下载glusterfs源
wget –P /etc/yum.repos.dhttp://download.gluster.org/pub/gluster/glusterfs/LATEST/CentOS/glusterfs-epel.repo
3.安装
Yum–y install glusterfs glusterfs-fuse glusterfs-server
4.启动
Systemctlstart glusterd.service
5.创建存储目录
mkdir–p /usr/local/share/models
Glusterfs1上配置
1.配置集群
[root@glusterfs1~]# gluster peer probe glusterfs1
peer probe: success. Probe on localhost not needed
[root@glusterfs1~]# gluster peer probe glusterfs2
peer probe: success.
[root@glusterfs1~]# gluster peer probe glusterfs3
peer probe: success.
2. 创建一个卷组
gluster volume create modelsglusterfs1:/usr/local/share/models glusterfs2:/usr/local/share/models glusterfs3:/usr/local/share/modelsforce
3.启动
gluster volume start models
4.检查
gluster peerstatus 查看peer状态
glustervolume info
glustervolume status gluster peer probe HOST(为peer的主机名)
gluster peerdetach HOST
docker-registry上安装
1.安装yum源
rpm -ivh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
2.下载glusterfs源
wget –P /etc/yum.repos.dhttp://download.gluster.org/pub/gluster/glusterfs/LATEST/CentOS/glusterfs-epel.repo
3.安装
yum–y install glusterfs glusterfs-fuse glusterfs-server
创建一个挂载目录
mkdir /mnt/glusterfs
挂载
mount -t glusterfs -o glusterfs1:models /mnt/models/
6.安装docker和registry
yum–y install docker
docker pull registry
dockerrun -d -p 5000:5000 -v /mnt/models:/tmp/registry docker.io/registry
原文:http://zengxh.blog.51cto.com/10650604/1721740