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

相关推荐
高旭博1 小时前
7. kubernetes资源——service服务
云原生·容器·kubernetes
斯普信专业组1 小时前
Docker 常用命令与时区配置指南
docker·容器·eureka
止水编程 water_proof2 小时前
Java--HTTP(上)
网络·网络协议·http
止水编程 water_proof10 小时前
Java-HTTP响应以及HTTPS(下)
网络·网络协议·http
2501_9151063213 小时前
App HTTPS 抓包 工程化排查与工具组合实战
网络协议·ios·小程序·https·uni-app·php·iphone
天一生水water13 小时前
ubuntu使用毫秒镜像方式安装docker mysql
ubuntu·阿里云·docker
0和1的舞者14 小时前
网络通信的奥秘:HTTP详解 (七)
服务器·网络·网络协议·http·okhttp·软件工程·1024程序员节
Qayrup16 小时前
docker 搭建私有仓库,推送并拉取
运维·docker·容器
郭庆汝16 小时前
docker拉取英伟达官方cuda11.8镜像
docker·cuda11.8
huangdengji17 小时前
基于openresty反向代理、dns劫持、实现对http请求、响应内容抓包
网络协议·http·openresty