配置Insecure Docker Registry支持http请求 (更改默认的https请求)

文章目录

小结

本文记录了如何配置Insecure http docker registry,也就是使用http请求 (更改默认的https请求)Docker Registry仓库。

问题

在测试环境中没有配置SSL/TLS, 需要使用http请求Docker Registry,也就是Containerd需要使用http处理请求,但是环境中的Containerd (CRI Container Runtime Interface)默认是使用https的,需要对默认的设置进行更改。

解决

对Kubernetes环境进行了以下修改:

1,修改/etc/docker/daemon.json,添加后结果如下:

json 复制代码
{
   "exec-opts":[
      "native.cgroupdriver=systemd"
   ],
   "insecure-registries":[
      "http://registry:80"
   ]
}

2, 重启docker服务

shell 复制代码
systemctl restart docker

3, 修改/etc/containerd/config.toml,添加以下内容:

shell 复制代码
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."registry:80"]
endpoint = ["http://registry:80"]

4, 重启containerd服务

shell 复制代码
systemctl restart containerd

配置完成,测试结果 :

shell 复制代码
[root@Master automated_deployment_script]# curl http://registry:80/v2/apiapp/tags/list
{"name":"apiapp","tags":["1.0"]}
[root@Master ~]# curl http://registry:80/v2/_catalog
{"repositories":[]}

参考

Stackoverflow: Docker repository server gave HTTP response to HTTPS client
containerd switching to HTTPS for HTTP registry after failed HEAD request

相关推荐
城管不管3 小时前
Docker核心---数据卷(堵门秘籍)
运维·docker·容器
rainFFrain4 小时前
Boost搜索引擎项目(详细思路版)
网络·c++·http·搜索引擎
BestAns4 小时前
Docker+Jenkins 自定义镜像指南
docker
2501_916007475 小时前
iOS App 上架实战 从内测到应用商店发布的全周期流程解析
android·ios·小程序·https·uni-app·iphone·webview
.Shu.5 小时前
计算机网络 HTTPS 全流程
网络协议·计算机网络·https
荔枝爱编程5 小时前
如何在 Docker 容器中使用 Arthas 监控 Java 应用
java·后端·docker
HONG_YANG6 小时前
2025 热门的 Web 化容器部署工具对比:Portainer VS Websoft9
docker
Peter·Pan爱编程8 小时前
Docker在Linux中安装与使用教程
linux·docker·eureka
__lll_11 小时前
Docker 从入门到实战:容器、镜像与 Compose 全攻略
前端·docker
猿究院--冯磊12 小时前
计算机网络--HTTP协议
网络协议·计算机网络·http