当前位置: 首页 > ai >正文

docker 推送仓库(含搭建、代理等)

1、配置代理,需要绕过认证问题

{"registry-mirrors": ["https://docker.registry.cyou","https://docker-cf.registry.cyou","https://dockercf.jsdelivr.fyi","https://docker.jsdelivr.fyi","https://dockertest.jsdelivr.fyi","https://mirror.aliyuncs.com","https://dockerproxy.com","https://mirror.baidubce.com","https://docker.m.daocloud.io","https://docker.nju.edu.cn","https://docker.mirrors.sjtug.sjtu.edu.cn","https://docker.mirrors.ustc.edu.cn","https://mirror.iscas.ac.cn","https://docker.rainbond.cc","https://do.nark.eu.org","https://dc.j8.work","https://dockerproxy.com","https://gst6rzl9.mirror.aliyuncs.com","https://registry.docker-cn.com","http://hub-mirror.c.163.com","http://mirrors.ustc.edu.cn/","https://mirrors.tuna.tsinghua.edu.cn/","http://mirrors.sohu.com/"],"insecure-registries": ["registry.docker-cn.com","docker.mirrors.ustc.edu.cn","192.168.198.90:5000"],"debug": true,"experimental": false,"proxies": {"http-proxy": "http://xxx:7890","https-proxy": "http://xxx:7890"}
}

 `insecure-registries ` 是放开认证问题,允许 Docker 仓库使用非 HTTPS 协议,基本上如果哪个镜像拉去失败了都在这里加。

`registry-mirrors` 是镜像地址

`proxies` 是代理地址

2、搭建docker仓库

# 1. 拉取官方Registry镜像(v2版本)
docker pull registry:2# 2. 启动私有仓库(数据持久化到/opt/registry-data,避免容器删除丢失)
docker run -d \-p 5000:5000 \--name local-registry \-v /opt/registry-data:/var/lib/registry \--restart=always \registry:2

3、编译推送

构建镜像

docker build -t 192.168.198.90:5000/gin-test:v1.0 -f go-demo.Dockerfile .

推送镜像

docker push 192.168.198.90:5000/gin-test:v1.0

验证镜像

curl http://192.168.198.90:5000/v2/_catalog | grep gin-testcurl http://192.168.198.90:5000/v2/gin-test/tags/list

成功的话,镜像如下:

[root@localhost k8s-deploy]#  docker push 192.168.198.90:5000/gin-test:v1.0
The push refers to repository [192.168.198.90:5000/gin-test]
2b73b368c293: Layer already exists
ca7ce6a1c22a: Layer already exists
f44f286046d9: Layer already exists
v1.0: digest: sha256:8b86e4cb05f61b4171b4bf2d8eeabf005c9601ed6f9da1cb74f149a82758e1e4 size: 950
[root@localhost k8s-deploy]# curl http://192.168.198.90:5000/v2/_catalog
{"repositories":["ambassador-telepresence-manager","gin-test"]}
[root@localhost k8s-deploy]# curl http://192.168.198.90:5000/v2/gin-test/tags/list
{"name":"gin-test","tags":["v1.0"]}
[root@localhost k8s-deploy]# curl http://192.168.198.90:5000/v2/_catalog | grep gin-test% Total    % Received % Xferd  Average Speed   Time    Time     Time  CurrentDload  Upload   Total   Spent    Left  Speed
100    64  100    64    0     0  37470      0 --:--:-- --:--:-- --:--:-- 64000
{"repositories":["ambassador-telepresence-manager","gin-test"]}

http://www.xdnf.cn/news/20214.html

相关文章:

  • 服务器线程高占用定位方法
  • 使用 Shell 脚本监控服务器 IOWait 并发送邮件告警
  • Python带状态生成器完全指南:从基础到高并发系统设计
  • C#实现导入CSV数据到List<T>的完整教程
  • 【基础-单选】用哪一种装饰器修饰的struct表示该结构体具有组件化能力?
  • Playwright携手MCP:AI智能体实现自主化UI回归测试
  • 第26节:GPU加速计算与Compute Shader探索
  • Homebrew执行brew install出现错误(homebrew-bottles)
  • Go语言后端开发面试实战:谢飞机的“硬核”面试之旅
  • CodeBuddy 辅助重构:去掉 800 行 if-else 的状态机改造
  • Eclipse下的一些快捷键备忘录
  • LangChain实战(十九):集成OpenAI Functions打造强大Agent
  • Day37 MQTT协议 多客户端服务器模型
  • 手写MyBatis第53弹: @Intercepts与@Signature注解的工作原理
  • 工业洗地机和商用洗地机的区别是什么?
  • 【基础-单选】关于bundleName,下列说法正确的是?
  • 波特率vs比特率
  • rh134第三章复习总结
  • 贪心算法应用:保险理赔调度问题详解
  • Java中的死锁
  • 使用 MongoDB.Driver 在 C# .NETCore 中实现 Mongo DB 过滤器
  • [数据结构] ArrayList(顺序表)与LinkedList(链表)
  • 万代《宝可梦》主题新品扭蛋公开!史上最大尺寸
  • 机器人控制器开发(传感器层——奥比大白相机适配)
  • 【FastDDS】Layer Transport ( 05-Shared Memory Transport)
  • 天气预报云服务器部署实战
  • 在Java AI项目中实现Function Call功能
  • 计算机毕设大数据方向:基于Spark+Hadoop的餐饮外卖平台数据分析系统【源码+文档+调试】
  • 通过Idea 阿里插件快速部署java jar包
  • 实用向:Linux Shell 脚本实现 CPU / 内存 / 硬盘 + IO / 网络多指标告警(支持 163/QQ/139 邮箱)