栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

本地 DockerHub:Docker Registry

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

本地 DockerHub:Docker Registry

Docker Registry Commands

Start your registry

docker run -d -p 5000:5000 --name registry registry:2

Pull (or build) some image from the hub

docker pull ubuntu

Tag the image so that it points to your registry

docker image tag ubuntu localhost:5000/myfirstimage

Push it

docker push localhost:5000/myfirstimage

Pull it back

docker pull localhost:5000/myfirstimage

Now stop your registry and remove all data

docker container stop registry && docker container rm -v registry
查看注册了哪些镜像

访问:http://localhost:5000/v2/_catalog

用 Dockerfile 构建、发布

原文点击这里

普通推送:

docker tag image1 uid/image:1.0
docker push uid/image:1.0
docker tag image1 uid/image
docker push uid/image

使用本地仓库:

docker tag image2 localhost:5000/image:2.0
docker push localhost:5000/image:2.0
docker tag image2 localhost:5000/image
docker push localhost:5000/image
常见问题
    由于启动的 registry 服务不是安全可信赖的,在其他服务器上推送会显示:
$ docker push 10.1.2.9:5000/test
Using default tag: latest
The push refers to repository [10.1.2.9:5000/test]
Get "https://10.1.2.9:5000/v2/": http: server gave HTTP response to HTTPS client

a. 这时需要修改客户端的 Docker 引擎配置文件来信任这个仓库。修改客户端配置文件 /etc/docker/daemon.json,如果没有该文件或文件夹需手动进行创建。在文件中添加 insecure-registries,内容为 registry 的服务地址:(重启后生效)

// 客户端配置文件
{
  "registry-mirrors": [ "https://pee6w651.mirror.aliyuncs.com"],
  "insecure-registries": ["registry所在的ip地址:5000"]
}
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/748231.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号