Centos7上部署Docker私有仓库

Author Avatar
子语 2017 - 10 - 11
  • 在其它设备中阅读本文章

Docker除了官网的docker hub外,还可以利用官方的镜像搭建自己的私有仓库。

环境准备

系统要求

要求 说明
系统 Centos 7
内核 4.13.5-1.el7.elrepo.x86_64
仓库地址 10.0.0.128:5000
docker 1.12.6

关闭防火墙

$ systemctl stop firewalld.service
$ systemctl disable firewalld.service
$ vim /etc/sysconfig/selinux
  SELINUX=disabled

搭建Docker私有仓库

搭建仓库

$ docker pull registry  // 拉取官方镜像
$ docker run -d -p 5000:5000 --restart=always --name myHub registry   // 运行官方镜像
$ curl localhost:5000/v2/_catalog  // 查看私有镜像仓库,此时为空
{"repositories":[]}

修改配置文件

$ vim /etc/sysconfig/docker
  OPTIONS='--insecure-registry 10.0.0.128:5000'
$ systemctl restart docker

上传镜像到私有仓库

$ docker tag mysql 10.0.0.128:5000/mysql:0.1  // docker tage image_name registry_ip:port/images_name:tag
$ docker push 10.0.0.128:5000/mysql:0.1  // 上传镜像
$ curl localhost:5000/v2/_catalog   // 查看仓库镜像                             
{"repositories":["mysql"]}

This blog is under a CC BY-NC-SA 3.0 Unported License
本文链接:http://yov.oschina.io/article/容器/Docker/Centos7上部署Docker私有仓库/