Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker registry上传镜像报HTTPS的错怎么解决? #41

Open
stevencaocao opened this issue Nov 16, 2022 · 5 comments
Open

docker registry上传镜像报HTTPS的错怎么解决? #41

stevencaocao opened this issue Nov 16, 2022 · 5 comments
Assignees
Labels
bug Something isn't working question Further information is requested

Comments

@stevencaocao
Copy link

ERRO[0000] server "192.168.1.191:5000" does not seem to support HTTPS error="failed to do request: Head "https://192.168.1.191:5000/v2/alpine/blobs/sha256:43773d1dba76c4d537b494a8454558a41729b92aa2ad0feb23521c3e58cd0440\": http: server gave HTTP response to HTTPS client"
INFO[0000] Hint: you may want to try --insecure-registry to allow plain HTTP (if you are in a trusted network)
FATA[0000] failed to do request: Head "https://192.168.1.191:5000/v2/alpine/blobs/sha256:43773d1dba76c4d537b494a8454558a41729b92aa2ad0feb23521c3e58cd0440": http: server gave HTTP response to HTTPS client

@houseonline
Copy link
Collaborator

houseonline commented Nov 16, 2022

這是可能你本地Docker配寘的問題,可以通過下麵的參攷方法進行配寘:

方法一:
[root@linux-08]# vi /usr/lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd --insecure-registry 192.168.1.191:5000

[root@linux-08]# systemctl daemon-reload && systemctl restart docker

方法二:
[root@linux-08]# vi /etc/docker/daemon.json
{
"registry-mirrors": ["https://registry.docker-cn.com"],
"insecure-registries": ["192.168.1.191:5000"]
}

[root@linux-08]# systemctl daemon-reload && systemctl restart docker

方法三:
[root@linux-08]# cat /etc/docker/daemon.json
{
"registry-mirrors": [
"https://registry.docker-cn.com"
]
}
{
"insecure-registry":["192.168.1.191:5000"]
}

[root@linux-08]# systemctl daemon-reload && systemctl restart docker

更多配寘請查看Docker官方檔案。

@houseonline houseonline self-assigned this Nov 16, 2022
@houseonline houseonline added the question Further information is requested label Nov 16, 2022
@stevencaocao
Copy link
Author

你好!

我看了上面三种方法,都是常规安装docker和docker registry的解决办法, 使用kube-install一件安装k8s环境后,安装目录不清楚是哪一个,另外docker服务也并不是docker.service,找不到这个服务。具体看如下在node机器上的操作日志

[root@k8s ~]# find / -name docker.service
/tmp/.kubeinstalltemp/data/k8s.cluster1/sys/0x0000000000base/docker/templates/docker.service
[root@k8s ~]# find / -name docker
find: ‘/proc/6132’: 没有那个文件或目录
/run/containerd/io.containerd.runtime.v2.task/k8s.io/8c5d65185bf730c9265c7439c7c81079e8c94e1f140d6a4d032f34bf00a1c898/rootfs/etc/docker
/tmp/.kubeinstalltemp/data/k8s.cluster1/sys/0x0000000000base/docker
/opt/kube-install/k8s/runtime/containerd/io.containerd.snapshotter.v1.overlayfs/snapshots/20/fs/etc/docker
/opt/kube-install/k8s/runtime/containerd/io.containerd.snapshotter.v1.overlayfs/snapshots/169/fs/etc/docker
[root@k8s ~]# systemctl daemon-reload && systemctl restart docker
Failed to restart docker.service: Unit not found.

@stevencaocao
Copy link
Author

你好!
问题已解决,由于我安装的k8s是1.24,容器改用containerd我还以为是docker,因此找不到以上docker配置及服务。
推送和拉取镜像使用ctr -n=k8s.io images push --plain-http=true 192.168.1.191:5000/镜像名称:镜像tag就可以了。
另外web页面里面给的例子少了--plain-http=true,因此按照例子做不成功。

@houseonline
Copy link
Collaborator

houseonline commented Nov 16, 2022

由于我安装的k8s是1.24,容器改用containerd我还以为是docker,因此找不到以上docker配置及服务。

如果你想使用docker的話,可以部署v1.23及以下版本。 由於k8s v1.24版本已經默認不支持docker了,所以我們相容了官方推薦的containerd。

@houseonline
Copy link
Collaborator

houseonline commented Nov 16, 2022

你好!
1.24,容器改用containerd。另外web页面里面给的例子少了--plain-http=true,因此按照例子做不成功。

Thank you very much for your feedback!

我們已經修復了這個問題,新發佈的版本中將不會有這個誤會的提示。

@houseonline houseonline added the bug Something isn't working label Nov 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants