Bootstrap

群晖docker获取私有化镜像http: server gave HTTP response to HTTPS client].

群晖docker获取私有化镜像提示http: server gave HTTP response to HTTPS clien

问题描述

层级时间用户事件
Information2023/07/08 12:47:45cxlogeAdd image from xx.xx.31.240:1923/go-gitea/gitea:1.19.3
Error2023/07/08 12:47:48cxlogeFailed to pull image [Get "https://xx.xx.31.240:1923/v2/": http: server gave HTTP response to HTTPS client].

解决方法

通过ps -ef|grep docker获取配置dockerd --config-file的路径为/var/packages/ContainerManager/etc/dockerd.json

然后添加添加insecure-registries的http认证


cat /var/packages/Docker/etc/dockerd.json # 群晖
cat /etc/docker/daemon.json   # linux
cat C:\Users\cxloge\.docker\daemon.json # windowns


cxloge@synocxloge:~$ ps -ef|grep docker
root      7780     1  0 Jul07 ?        00:00:00 /var/packages/ContainerManager/target/tool/docker_event_watcherd
root      7796     1  0 Jul07 ?        00:00:08 /var/packages/ContainerManager/target/usr/bin/dockerd --config-file /var/packages/ContainerManager/etc/dockerd.json
root      7848  7796  0 Jul07 ?        00:00:05 containerd --config /var/run/docker/containerd/containerd.toml --log-level info
cxloge   11662  9796  0 13:15 pts/0    00:00:00 grep --color=auto docker

# 备份 dockerd.json
cxloge@synocxloge:~$ sudo cp /var/packages/ContainerManager/etc/dockerd.json /var/packages/ContainerManager/etc/dockerd.json.bak

cxloge@synocxloge:~$ cd /var/packages/ContainerManager/etc/
cxloge@synocxloge:/var/packages/ContainerManager/etc$ ls -la
total 16
drwxr-xr-x 1 root root 112 Jul  8 13:30 .
drwxr-xr-x 1 root root 300 Jul  8 09:45 ..
drwxr-xr-x 1 root root   0 Jul  7 23:22 cert
-rw------- 1 root root 122 Jul  7 23:22 dockerd.json
-rw------- 1 root root 122 Jul  8 13:30 dockerd.json.bak # 备份
-rw-r--r-- 1 root root  14 Jul  7 23:22 pkg_version
-rw------- 1 root root 615 Jul  8 12:46 registry.json


cxloge@synocxloge:~$ sudo cat /var/packages/ContainerManager/etc/dockerd.json
{"data-root":"/var/packages/ContainerManager/var/docker","log-driver":"db","registry-mirrors":[],"storage-driver":"btrfs"}

cxloge@synocxloge:~$ sudo vi /var/packages/ContainerManager/etc/dockerd.json
cxloge@synocxloge:~$ sudo cat /var/packages/ContainerManager/etc/dockerd.json
{
        "data-root": "/var/packages/ContainerManager/var/docker",
        "log-driver": "db",
        "registry-mirrors": [],
        "storage-driver": "btrfs",
        "insecure-registries" : [  "xx.xxx.31.240:1923","xx.xxx.31.37:7300" ] ## 添加该配置的私有化仓库的地址端口
}


root@mini918:~# cat /etc/docker/daemon.json
 {
 "insecure-registries": [ "http://192.168.3.215:5050" ],
       "registry-mirrors": [
          "https://2a6bf1988cb6428c877f723ec7530dbc.mirror.swr.myhuaweicloud.com",
          "https://docker.m.daocloud.io",
          "https://hub-mirror.c.163.com",
          "https://mirror.baidubce.com",
          "https://your_preferred_mirror",
          "https://dockerhub.icu",
          "https://docker.registry.cyou",
          "https://docker-cf.registry.cyou",
          "https://dockercf.jsdelivr.fyi",
          "https://docker.jsdelivr.fyi",
          "https://dockertest.jsdelivr.fyi",
          "https://mirror.aliyuncs.com",
          "https://dockerproxy.com",
          "https://mirror.baidubce.com",
          "https://docker.m.daocloud.io",
          "https://docker.nju.edu.cn",
          "https://docker.mirrors.sjtug.sjtu.edu.cn",
          "https://docker.mirrors.ustc.edu.cn",
          "https://mirror.iscas.ac.cn",
          "https://docker.rainbond.cc"
          ]
}
运行使用
http://192.168.1.x:1850/v2/_catalog
{"repositories":[]}
root@mini918:~# docker push 192.168.3.215:5050/whyour/qinglong
Using default tag: latest
The push refers to repository [192.168.3.215:5050/whyour/qinglong]
5f70bf18a086: Pushed
fd68a3abc289: Pushed
cd43c4b009a7: Pushed
8f7948c639f2: Pushed
57f09924e74c: Pushed
75cec5ae6984: Pushed
5b93f923fc43: Pushed
d8362f78f67b: Pushed
1e84b8a3e3cd: Pushed
a0904247e36a: Pushed
latest: digest: sha256:dadafa405a1c3c724e647eae5f2b56da8a233c7772d84b7079c404d37eda6821 size: 2420

root@dsm3622:~# docker pull 192.168.3.30:5050/mysql-server:5.7
Error response from daemon: Get "http://192.168.3.30:5050/v2/": context deadline exceeded
root@dsm3622:~# docker pull 192.168.3.30:5050/mysql/mysql-server:5.7
Error response from daemon: Get "http://192.168.3.30:5050/v2/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

curl: (28) Failed to connect to 192.168.3.30 port 5050 after 127333 ms: Connection timed out

root@dsm3622:~# curl http://192.168.3.30:5050/v2/_catalog

^C
root@dsm3622:~# curl http://localhost:5050/v2/_catalog
{"repositories":["dlandon/zoneminder","joplin/server","linuxserver/mariadb","mysql/mysql-server","scofieldpeng/dnspod-ddns","whyour/qinglong"]}


root@dsm3622:~# docker pull localhost:5050/mysql/mysql-server:5.7
5.7: Pulling from mysql/mysql-server
d26998a7c52d: Pull complete
ccc399c311f6: Pull complete
0edfb7c01b4a: Pull complete
194a94060e3f: Pull complete
ddf241d4eab5: Pull complete
6696fb408e54: Pull complete
21e72799590e: Pull complete
5270ca196c95: Pull complete
Digest: sha256:7906de19577d74033a9a56534462aa158868eeed99e7d6989b654261ddab112c
Status: Downloaded newer image for localhost:5050/mysql/mysql-server:5.7
localhost:5050/mysql/mysql-server:5.7
 

;