配置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

相关推荐
Tandy12356_2 小时前
手写TCP/IP协议栈——HTTP协议实现(完结篇)
c语言·网络·网络协议·tcp/ip·计算机网络·http
丁总学Java2 小时前
微信小程序上传揭秘:http://tmp 临时文件是如何“飞”到后端的?
http·微信小程序·小程序
SilentCodeY2 小时前
iptables 防 Docker 绕过:DOCKER-USER 链限制 Nacos 8848 仅 localhost 可访问
docker·容器·iptables
2501_915106326 小时前
iOS 成品包加固,在只有 IPA 的情况下,能做那些操作
android·ios·小程序·https·uni-app·iphone·webview
詹某某34117 小时前
网站被提示“不安全”怎么解决
网络协议·https·ssl
爱上猫de鱼7 小时前
linux环境docker部署前后端应用
linux·运维·docker
廋到被风吹走8 小时前
gRPC 深度解析:Protocol Buffers、HTTP/2、流式传输与拦截器设计
网络·网络协议·http
南宫乘风8 小时前
Kubernetes 中 ConfigMap 和 Secret 热更新:Reloader 实战指南
容器·kubernetes·configmap
辰尘_星启8 小时前
解决幽灵容器
linux·docker·容器·机器人·嵌入式
破无差8 小时前
docker配置报错解决过程dify
docker