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

相关推荐
wwj888wwj7 小时前
Docker基础(复习)
java·linux·运维·docker
执行部之龙7 小时前
https连接建立以及密钥加密详解
网络协议·http·https
DONG9998 小时前
配置docker代理
docker·容器
怎么就重名了8 小时前
docker可以动态修改端口映射吗
运维·docker·容器
JEECG低代码平台9 小时前
敲敲云零代码平台一键部署实战:命令安装 vs Docker 安装
运维·docker·容器
奋斗tree10 小时前
HTTP Error 503 常见原因及解决方案
网络·网络协议·http
p***769810 小时前
NAS飞牛Docker 部署OmniBox影视资源聚合平台:网盘秒播、影视聚合、自定义直播,超神的一条龙服务
运维·docker·容器
johnny23311 小时前
Python生态HTTP客户端类库:requests、httpx、aiohttp、Niquests、httpcore
python·http
http阿拉丁神猫12 小时前
kubernetes知识点汇总31-36
云原生·容器·kubernetes
爱学习的程序媛13 小时前
Docker 完全指南:从入门到生产级实践
运维·docker·容器