docker怎么在本地建仓库

docker怎么在本地建仓库

docker怎么在本地建仓库?

1.安装docker

yum install docker -y

之后根据需求把指定docker安装目录,或者新建一个磁盘使用docker-storage-setup来使用

2.设置第三方docker镜像来做加速

vim /etc/docker/daemon.json
{"registry-mirrors": ["http://hub-mirror.c.163.com",{"insecure-registries":["registry:5000"]}]
}

3.安装docker本地仓库

systemctl start docker
docker pull docker.io/registry
docker images

4.启动本地仓库

docker run -d --name=registry -p 5000:5000 docker.io/registry

5.上传镜像到仓库中

使用Nexus搭建Maven私服 中文WORD版 使用Nexus搭建M*en* 中文WORD版

本文档主要讲述的是使用Nexus搭建M*en*;*是架设在局域网的一种特殊的远程仓库,目的是代理远程仓库及部署第三方构件。有了*之后,当 M*en 需要下载构件时,直接请求*,*上存在则下载到本地仓库;否则,*请求外部的远程仓库,将构件下载到*,再提供给本地仓库下载。感兴趣的朋友可以过来看看

使用Nexus搭建Maven私服 中文WORD版 0 查看详情 使用Nexus搭建Maven私服 中文WORD版
docker tag docker.io/registry registry:5000/resistry:v1
docker push registry:5000/resistry:v1

6.登陆到registry查看上传的内容

docker exec -it registry sh
/ # ls /var/lib/registry/docker/registry/v2/repositories/resistry

7.查看仓库的images目录

[root@localhost ~]# curl http://registry:5000/v2/_catalog  #目录{"repositories":["centos","resistry"]}
[root@localhost ~]# curl http://registry:5000/v2/centos/tags/list  #image的版本信息{"name":"centos","tags":["6.9","6"]}
[root@localhost ~]# curl http://registry:5000/v2/image_name/tags/list{"errors":[{"code":"NAME_UNKNOWN","message":"repository name not known to registry","detail":{"name":"image_name"}}]}
[root@localhost ~]#

8.其他服务器从registry来获取镜像,追加以下信息

vim /etc/docker/daemon.json
{
{"insecure-registries":["registry:5000"]}
}

9.获取images

docker pull registry:5000/centos:6.9docker images
REPOSITORY             TAG                 IMAGE ID            CREATED             SIZE
registry:5000/centos   6.9                 2199b8eb8390        11 months ago       195 MB

相关推荐:docker教程

以上就是docker怎么在本地建仓库的详细内容,更多请关注其它相关文章!

本文转自网络,如有侵权请联系客服删除。