制作docker 离线仓库

制作docker 离线仓库

1、前言

本文章在centos7.6系统操作

2、步骤

安装docker-distribution

yum install  epel-release
yum install  docker-distribution

编辑docker-distribution服务的配置,使用yaml进行的配置

[root@test yum.repos.d]# cat /etc/docker-distribution/registry/config.yml
version: 0.1
log:
  fields:
    service: registry
storage:
    cache:
        layerinfo: inmemory
    filesystem:
        rootdirectory: /var/lib/registry                       //对应的仓库目录
http:
    addr: :5000                            //仓库端口号

将拿到的仓库image文件解压到 /var/lib/registry/ 目录下 这个目录应与上面配置文件的目录一致。目录结构如下:

/var/lib/registry/docker/registry/v2/xxxxx

启动仓库服务

# systemctl start docker-distribution

编辑docker 配置

vim /etc/docker/daemon.json
{
  "enable-secrets": false,
  "insecure-registries": ["192.168.10.12:5000"]
}

测试

用浏览器打开 http://192.168.10.12:5000/v2/ 。看到如下结果说明配置成功

用浏览器打开http://192.168.10.12:5000/v2/_catalog, 查看私有仓库现在有哪些images(ps:输出比较乱).

用浏览器打开 http://10.0.219.92:5000/v2/ceph-daemon/tags/list ,查看私有仓库的ceph-daemon镜像,有哪些tag

3、将镜像上传到私有仓库

docker tag  ceph-daemon  192.168.10.12:5000/ceph-daemon:latest  

docker push 192.168.10.12:5000/ceph-daemon:latest

4、私有仓库的使用

# docker pull 192.168.10.12:5000/ceph-daemon:latest  
// docker  pull  <仓库ip>:<端口号>/<路径>:<tag>

原文地址:https://www.cnblogs.com/yanling-coder/p/11712663.html