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

相关推荐
一只懒鱼a1 分钟前
docker部署nacos (版本2.3.2)
运维·docker
码农水水3 小时前
京东Java面试被问:HTTP/2的多路复用和头部压缩实现
java·开发语言·分布式·http·面试·php·wpf
青衫客365 小时前
浅谈Kubernetes在systemd cgroup模式下的Slice/Scope组织结构
云原生·容器·kubernetes
王九思5 小时前
Podman 介绍
docker·云原生·kubernetes·podman
2501_915909066 小时前
原生与 H5 共存情况下的测试思路,混合开发 App 的实际测试场景
android·ios·小程序·https·uni-app·iphone·webview
游戏开发爱好者87 小时前
了解 Xcode 在 iOS 开发中的作用和功能有哪些
android·ios·小程序·https·uni-app·iphone·webview
xfan_me8 小时前
SSL证书与HTTPS:为什么你的网站必须启用加密连接?
网络协议·https·ssl
运维螺丝钉8 小时前
docker安装应用
运维·docker·容器
optimistic_chen8 小时前
【Docker入门】cgroups 资源控制
linux·运维·ubuntu·docker·容器·cgroup
林九生9 小时前
【MySQL/PostgreSQL】MySQL 到 PostgreSQL 数据迁移:Docker + pgloader
mysql·docker·postgresql