centos7搭建docker本地regsitry
来源:互联网 发布:php 身份证号码 编辑:程序博客网 时间:2024/05/22 12:26
参考:Docker部署私有仓库
一、环境准备
1. ip
2. 关闭防火墙
systemctl stop firewalld.servicesystemctl disable firewalld.service
3. 关闭本地selinux防火墙
sed -i 's/SELINUX=.*/SELINUX=disabled/' /etc/sysconfig/selinux init 6
二、搭建
1. 搭建仓库 registry
docker pull regsity
2. 基于私有仓库镜像运行容器
docker run -d -p 5000:5000 -v /data/docker/registry:/tmp/registry docker.io/registry
3. 访问私有仓库
# 网上都用这个curl 127.0.0.1:5000/v1/search
,但是报404 page not found
,后查证是v1版本的api查看方式,我们现在的版本是v2,所以用如下方法查看:
>curl -X GET http://1.1.1.100:5000/v2/_catalog{"repositories":[]} #私有仓库为空,没有提交新镜像到仓库中
4. 为基础镜像打个标签
# 根据 images id 建立 tag
docker tag a374fd62f97f 1.1.1.100:5000/centos
5. 改Docker配置文件制定私有仓库url
vim /etc/sysconfig/dockerOPTIONS='--selinux-enabled --insecure-registry 1.1.1.100:5000'systemctl restart docker
6. 提交镜像到本地私有仓库中
docker push 1.1.1.100:5000/centosorfor i in `docker images|grep 1.1.1.100|awk '{print $1}'`;do docker pull $i;done
7. 查看私有仓库是否存在对应的镜像
root@localhost ~> curl -X GET http://1.1.1.100:5000/v2/_catalog{"repositories":["centos","nginx"]}> curl -X GET http://1.1.1.100:5000/v2/centos/tags/list{"name":"centos","tags":["latest"]}
三、在docker客户机验证
1. 修改Docker配置文件
vim /etc/sysconfig/dockerOPTIONS='--selinux-enabled --insecure-registry 1.1.1.100:5000'systemctl restart docker
2. 从私有仓库中下载已有的镜像
docker pull 1.1.1.100:5000/centosUsing default tag: latestTrying to pull repository 1.1.1.100:5000/centos ... latest: Pulling from 1.1.1.100:5000/centosDigest: sha256:fd9058a6149809b2f4725bb4461294ceebb59e587435f3509c2c8dcc9ee1d5b4Status: Downloaded newer image for 1.1.1.100:5000/centos:latest
查看
> docker imagesREPOSITORY TAG IMAGE ID CREATED SIZE1.1.1.100:5000/centos latest a374fd62f97f 11 weeks ago 194.5 MBdocker.io/centos 6.8 a374fd62f97f 11 weeks ago 194.5 MB
运行
> docker run -itd 1.1.1.100:5000/centos56c2da2c1e9e70146b71a68f829e89756664f1e2a67abf369baac524c65deb25> docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES56c2da2c1e9e 1.1.1.100:5000/centos "/bin/bash" About a minute ago Up About a minute thirsty_elion
- 自此,docker本地仓库搭建完成。。。
0 0
- centos7搭建docker本地regsitry
- centos7搭建docker本地regsitry
- 安装 docker-regsitry
- docker pull push到docker-regsitry上
- 搭建Docker(CentOS7)
- centos7搭建docker
- CentOS7 本地源搭建
- 搭建本地gitlab【CentOS7】
- 搭建本地Docker环境
- CentOS7搭建Docker私有仓库
- CentOS7搭建Docker私有仓库
- CentOS7+Docker+Redis3环境搭建
- CentOS7搭建Docker私有仓库
- Centos7搭建Docker私有库
- CentOS7搭建Docker私有仓库
- centos7 docker私有仓库搭建
- centos7下docker-ce搭建
- CentOS7 搭建docker registry 私库
- sed与awk读书笔记[sed篇]
- 大数据处理实例——Amazon商品评分&评论(三)
- 第四周项目1—星号拼字母
- 示波器输入阻抗匹配问题
- python学习心得(2) --- xml解析
- centos7搭建docker本地regsitry
- 修改 VS2013 项目属性的默认包含路径(全局)
- hihocoder #1233 : Boxes 北京赛区(2015)网络赛(状态压缩+bfs)
- 智能指针
- Tensorflow图片数据读取
- Codeforces 719A-Vitya in the Countryside
- 详解四种基本布局
- button变色
- Kubernetes系统架构简介