docker私有仓库搭建

环境:
centos 7.2 X64
jdk1.8

一、首先安装 docker

yum -y install docker
systemctl start docker
systemctl enable docker

二、下载私有仓库有镜像

docker pull registry

关闭防火墙

systemctl stop firewalld.service  
systemctl disable firewalld.service 

三、运行私有仓库

docker run -d -p 5000:5000 --restart always -v /opt/data/registry:/tmp/registry registry

参数说明:
-v /opt/registry:/tmp/registry :默认情况下,会将仓库存放于容器内的/tmp/registry目录下,指定本地目录挂载到容器
–privileged=true :CentOS7中的安全模块selinux把权限禁掉了,参数给容器加特权,不加上传镜像会报权限错误(OSError:[Errno 13] Permission denied: ‘/tmp/registry/repositories/liibrary’)或者(Received unexpected HTTP status: 500 Internal Server Error)错误

四、修改/etc/sysconfig/docker(Ubuntu下配置文件地址为:/etc/init/docker.conf),增加启动选项

OPTIONS='--selinux-enabled --insecure-registry 172.172.177.75:5000'

重启docker

 systemctl restart docker 

五、测试私有仓库

docker pull hello-world
docker tag hello-world 172.172.177.75:5000/hello-world

其推送到私有仓库:

docker push 172.172.177.75:5000/hello-world

下载镜像

docker pull 172.172.177.75:5000/hello-world

查看仓库中镜像

http://172.172.177.75:5000/v2/_catalog
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值