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

2024 年 docker 提示index.docker.io

发现 docker 提示以下错误:

Error response from daemon: Get "https://index.docker.io/v1/search?q=nginx&n=25": dialing index.docker.io:443 container via direct connection because  has no HTTPS proxy: connecting to index.docker.io:443: dial tcp 96.44.137.28:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

配置阿里源后还是报错,尝试 docker info 命令发现配置已经生效,但就是错。更换其它国内源清华源、网易源仍然不行。

最后发现目前很多 docker hub 都关闭了,阿里源也只能使用在阿里产品范围内。所以要解决这个问就得自己搭建个私有 docker hub。


搭建私有 Docker Hub 的步骤如下:

1. 准备环境

  • 服务器:Linux 。
  • Docker:安装 Docker。

2. 选择私有仓库工具

常用的私有 Docker 仓库工具包括:

  • Docker Registry:官方提供的轻量级工具。
  • Harbor:企业级工具,提供更多功能。

3. 使用 Docker Registry 搭建私有仓库

3.1 创建配置文件

创建 config.yml 文件,配置如下:

version: 0.1
log:fields:service: registry
storage:filesystem:rootdirectory: /var/lib/registry
http:addr: :5000headers:X-Content-Type-Options: [nosniff]
health:storagedriver:enabled: trueinterval: 10sthreshold: 3
3.2 启动 Docker Registry

使用以下命令启动:

docker run -d \-p 5000:5000 \--name registry \-v $(pwd)/config.yml:/etc/docker/registry/config.yml \-v /var/lib/registry:/var/lib/registry \registry:2
3.3 测试私有仓库

推送镜像到私有仓库:

docker tag my-image localhost:5000/my-image
docker push localhost:5000/my-image

拉取镜像:

docker pull localhost:5000/my-image

4. 使用 Harbor 搭建私有仓库

4.1 下载 Harbor

从 Harbor GitHub 下载安装包并解压。

4.2 配置 Harbor

编辑 harbor.yml 文件,设置主机名、端口和数据存储路径。

4.3 安装 Harbor

运行安装脚本:

sudo ./install.sh
4.4 访问 Harbor

通过浏览器访问 http://<your-hostname>,使用默认账户 admin 和密码 Harbor12345 登录。

4.5 推送和拉取镜像

推送镜像:

docker tag my-image <your-harbor-host>/my-project/my-image
docker push <your-harbor-host>/my-project/my-image

拉取镜像:

docker pull <your-harbor-host>/my-project/my-image

我是栈江湖,如果你喜欢此文章,不要忘记点赞+关注

http://www.lryc.cn/news/515091.html

相关文章:

  • TCP粘/拆包----自定义消息协议
  • Modbus知识详解
  • Java-创建一个结合CompletableFuture和自定义功能的工具类
  • 【MATLAB第111期】基于MATLAB的sobol全局敏感性分析方法二阶指数计算
  • C语言-sprintf
  • APM 3.0.2 | 聚合B站、油管和MF的音乐播放器,支持歌词匹配
  • Mono 和 IL2Cpp的区别
  • 力扣第389题—找不同
  • 我的桌面 1.9.75 | 个性化定制手机桌面,丰富的小组件和主题
  • 【Java项目】基于SpringBoot的【垃圾分类系统】
  • 生成埃里克卡特曼人工智能语音听起来像他或配音视频
  • C语言中的va_list
  • idea无法安装插件
  • 智汇厦门:苏哒智能携其智能化产品亮相文心中国行现场
  • C++函数模板的定义为何要和调用点放在一起
  • Nginx - 整合lua 实现对POST请求的参数拦截校验(不使用Openresty)
  • 互联网直播点播平台EasyDSS无人机视频推拉流技术实现工地远程监控巡检直播
  • Unity3D 基于GraphView实现的节点编辑器框架详解
  • 【C++】开源:Armadillo数值计算库配置与使用
  • HackMyVM-Airbind靶机的测试报告
  • C语言----函数
  • MySQL图形化界面工具--DataGrip
  • PyTorch AMP 混合精度中grad_scaler.py的scale函数解析
  • 【Ubuntu20.04】Apollo10.0 Docker容器部署+常见错误解决
  • 【文献精读笔记】Explainability for Large Language Models: A Survey (大语言模型的可解释性综述)(二)
  • 朱姆沃尔特隐身战舰:从失败到威慑
  • 免费分享 | 基于极光优化算法PLO优化宽度学习BLS实现光伏数据预测算法研究附Matlab代码
  • logback日志文件多环境配置路径
  • 面试高频:一致性hash算法
  • docker部署项目