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

相关推荐
多云的夏天2 小时前
docker容器部署-windows-ubuntu
java·docker·容器
@土豆3 小时前
k8s环境部署promethus及周边监控组件(复制粘贴就可完成部署)
云原生·容器·kubernetes
returnthem3 小时前
K8S笔记
kubernetes·云计算·paas
淡泊if4 小时前
1.2GB → 98MB,我的 Docker 镜像瘦身实战记录
运维·docker·容器
Sst的头号粉丝4 小时前
Docker——cgroups
运维·docker·容器
❀͜͡傀儡师5 小时前
Docker 部署Datart BI工具完整指南(PostgreSQL 持久化存储)
docker·postgresql·容器
l1t5 小时前
解决用docker安装umbra数据库遇到的FATAL:Operation not permitted错误
数据库·docker·容器
last demo6 小时前
docker存储
运维·docker·容器
无名-CODING6 小时前
从零开始!Vue3+SpringBoot前后端分离项目Docker部署实战(上):环境搭建与数据库容器化
数据库·spring boot·docker
Sst的头号粉丝7 小时前
Kubernetes——介绍
云原生·容器·kubernetes