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

相关推荐
徐同保35 分钟前
解决 Vue 3 项目 TypeScript 编译错误:@types/lodash 类型定义不兼容
redis·网络协议·https
大佐不会说日语~4 小时前
使用Docker Compose 部署时网络冲突问题排查与解决
运维·网络·spring boot·docker·容器
小徐敲java6 小时前
(运维)1Panel服务器面板Docker部署
运维·服务器·docker
曾几何时`7 小时前
Docker容器化部署编译运行模块
运维·docker·容器
2501_915921438 小时前
傻瓜式 HTTPS 抓包,简单抓取iOS设备数据
android·网络协议·ios·小程序·https·uni-app·iphone
塔克拉玛攻城狮9 小时前
最新!银河麒麟v11 kubeadm部署k8s v1.35.0高可用集群
kubernetes·银河麒麟
Suchadar10 小时前
Docker基础命令(二)——数据卷管理端口映射与容器互联
运维·docker·容器
firstacui10 小时前
Docker容器网络管理与容器数据卷管理
运维·docker·容器
王锋(oxwangfeng)10 小时前
Apache Flink 在 Kubernetes 上的高效部署与优化实践
flink·kubernetes·apache