环境:两个装有Docker的CentOs虚拟机 
虚拟机一:10.10.108.76 用户开发机 
虚拟机二:10.10.108.74 用作私有仓库

此处我们准备了两个虚拟机,分别都安装了Docker,其中76机器用作开发机,74机器用作registry私有仓库机器。环境准备好之后接下来我们就开始搭建私有镜像仓库。

1、**网卡

# vi /etc/sysconfig/network-scripts/ifcfg-eno16777728

修改此行

ONBOOT=yes

# /etc/init.d/network restart

2、关闭本地防火墙并设置开机不自启动

# systemctl stop firewalld.service

# systemctl disable firewalld.service

 

3、关闭本地selinux防火墙

 

# vi /etc/sysconfig/selinux 

SELINUX=disabled

# setenforce 0  

3、基于私有仓库镜像运行容器

[[email protected] ~]# docker run -d -p 5000:5000 -v /opt/data/registry:/tmp/registry docker.io/registry

构建Docker私有仓库

构建Docker私有仓库构建Docker私有仓库

4.查看私有仓库里的镜像(一定要保证下面能查看到仓库里有镜像!如果仓库里没有镜像,那么客户端机器就无法从该私有仓库下载镜像了)

curl -XGET http://10.10.108.74:5000/v2/_catalog 

curl -XGET http://10.10.108.74:5000/v2/tomcat/tags/list

构建Docker私有仓库构建Docker私有仓库

通过浏览器访问:

构建Docker私有仓库

构建Docker私有仓库


在客户端10.10.108.76上访问私有仓库镜像:

构建Docker私有仓库构建Docker私有仓库

构建Docker私有仓库


相关文章:

  • 2021-09-16
  • 2021-04-25
  • 2021-10-31
  • 2021-08-10
  • 2022-01-02
猜你喜欢
  • 2021-09-20
  • 2021-09-10
  • 2021-11-11
  • 2021-09-10
  • 2021-08-31
相关资源
相似解决方案