目錄docker鏡像倉庫hub.docker.com無法訪問-解決辦法1 個人鏡像站點2 dockerhub為什麼無法訪問2.1 查看dockerhub實際IP2.2 ping檢測3 鏡像加速3.1 使用國內鏡像加速3.1.1 docker配置:3.1.2 containerd配置:3.2 使用博主 ...
目錄
docker鏡像倉庫hub.docker.com無法訪問-解決辦法
文章主要內容:
-
個人鏡像站點
-
dockerhub為什麼無法訪問
-
鏡像加速
1 個人鏡像站點
話不多說,直接上dockerhub個人鏡像站點(每天限制10w訪問,只要不被封,一直免費提供訪問)
hub.axlinux.top
速度非常快,無需魔法可以直接訪問
可以進行鏡像搜索
也可以查看鏡像版本號
2 dockerhub為什麼無法訪問
最近許多群友都詢問為什麼無法訪問Docker鏡像倉庫,於是我也嘗試去訪問,結果果然無法訪問。
大家的第一反應就是給牆了,通過ping檢測紅的很可怕。
實際上是DNS被污染了,導致很多用戶都無法訪問。至於什麼是DNS污染,大家可以自行查詢,這裡主要講解怎麼解決dockerhub無法訪問的問題。
如果僅僅是dns污染,我們可以手動指定hosts文件進行訪問,但是實際的ip根本訪問不通。
2.1 查看dockerhub實際IP
3.228.146.75
18.210.197.188
18.206.20.10
2.2 ping檢測
全部丟包,無法訪問
[root@waluna ~]# ping -c1 3.228.146.75
PING 3.228.146.75 (3.228.146.75) 56(84) bytes of data.
--- 3.228.146.75 ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms
[root@waluna ~]# ping -c1 18.210.197.188
PING 18.210.197.188 (18.210.197.188) 56(84) bytes of data.
--- 18.210.197.188 ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms
[root@waluna ~]# ping -c1 18.206.20.10
PING 18.206.20.10 (18.206.20.10) 56(84) bytes of data.
--- 18.206.20.10 ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms
[root@waluna ~]#
3 鏡像加速
3.1 使用國內鏡像加速
常見的國內加速服務:
- 科大鏡像:https://docker.mirrors.ustc.edu.cn
- 網易:http://hub-mirror.c.163.com
- 阿裡雲:https://<你的ID>.mirror.aliyuncs.com
廢話不多說,直接上命令
3.1.1 docker配置:
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["鏡像加速地址"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
# 示例
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://eph8xfli.mirror.aliyuncs.com"] # 這是博主自己的阿裡雲鏡像加速地址,大家可以更換為自己的
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
阿裡雲官網也有不同操作系統的操作文檔,大家可以自行查閱
https://help.aliyun.com/document_detail/60750.html?spm=a2c4g.348824.0.0.742fa42dEeTNYo
3.1.2 containerd配置:
包括K8S鏡像加速
vim /etc/containerd/config.toml
[plugins."io.containerd.grpc.v1.cri".registry.mirrors]
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"]
endpoint = ["https://docker.mirrors.ustc.edu.cn","http://hub-mirror.c.163.com"]
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."gcr.io"]
endpoint = ["https://gcr.mirrors.ustc.edu.cn"]
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."k8s.gcr.io"]
endpoint = ["https://gcr.mirrors.ustc.edu.cn/google-containers/"]
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."quay.io"]
endpoint = ["https://quay.mirrors.ustc.edu.cn"]
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."ghcr.io"]
endpoint = ["https://ghcr.dockerproxy.com"]
3.2 使用博主個人鏡像倉庫
本鏡像倉庫在阿裡雲,主要包含K8S相關鏡像。如果大家有所需求,可以聯繫博主增加相關鏡像。
鏡像每天持續同步更新,目前有80+倉庫,包含新版和常用鏡像版本。
3.2.1 目前有如下鏡像倉庫,後續會陸續增加
docker.elastic.co:
- elasticsearch/elasticsearch
- kibana/kibana
- logstash/logstash
- beats/filebeat
- beats/heartbeat
- beats/packetbeat
- beats/auditbeat
- beats/journalbeat
- beats/metricbeat
- apm/apm-server
- app-search/app-search
quay.io:
- coreos/flannel
- ceph/ceph
- cephcsi/cephcsi
- csiaddons/k8s-sidecar
- csiaddons/volumereplication-operator
- prometheus/prometheus
- prometheus/alertmanager
- prometheus/pushgateway
- prometheus/blackbox-exporter
- prometheus/node-exporter
- prometheus-operator/prometheus-config-reloader
- prometheus-operator/prometheus-operator
- brancz/kube-rbac-proxy
- cilium/cilium
- cilium/operator-generic
- thanos/thanos
- cilium/certgen
- cilium/hubble-relay
- cilium/hubble-ui-backend
- cilium/hubble-ui
- cilium/cilium-etcd-operator
- cilium/operator
- cilium/startup-script
- cilium/clustermesh-apiserver
- coreos/etcd
- metallb/speaker
- frrouting/frr
- goharbor/nginx-photon
- goharbor/harbor-portal
- goharbor/harbor-core
- goharbor/harbor-jobservice
- goharbor/registry-photon
- goharbor/harbor-registryctl
- goharbor/chartmuseum-photon
- goharbor/trivy-adapter-photon
- goharbor/notary-server-photon
- goharbor/notary-signer-photon
- goharbor/harbor-db
- goharbor/redis-photon
- goharbor/harbor-exporter
k8s.gcr.io:
- dns/k8s-dns-node-cache
- metrics-server/metrics-server
- kube-state-metrics/kube-state-metrics
- prometheus-adapter/prometheus-adapter
- sig-storage/nfs-subdir-external-provisioner
- sig-storage/csi-node-driver-registrar
- sig-storage/csi-provisioner
- sig-storage/csi-resizer
- sig-storage/csi-snapshotter
- sig-storage/csi-attacher
- sig-storage/nfsplugin
registry.k8s.io:
- pause
- etcd
- conformance
- kube-proxy
- kube-apiserver
- kube-scheduler
- kube-controller-manager
- coredns/coredns
- ingress-nginx/controller
- ingress-nginx/opentelemetry
- ingress-nginx/controller-chroot
- ingress-nginx/kube-webhook-certgen
- defaultbackend-amd64
- cpa/cluster-proportional-autoscaler
- autoscaling/addon-resizer
gcr.io:
- kaniko-project/executor
- google-samples/xtrabackup
- kubebuilder/kube-rbac-proxy
docker.io:
- calico/node
- calico/typha
- calico/cni
- calico/node
- calico/kube-controllers
- calico/pod2daemon-flexvol
- kubesphere/openelb
- aledbf/kube-keepalived-vip
3.2.2 使用方式
docker.elastic.co/kibana/{image_name} ==> registry.cn-hangzhou.aliyuncs.com/waluna/{image_name}
quay.io/csiaddons/{image_name} ==> registry.cn-hangzhou.aliyuncs.com/waluna/{image_name}
k8s.gcr.io/{image_name} ==> registry.cn-hangzhou.aliyuncs.com/waluna/{image_name}
....
3.2.3 拉取鏡像
docker pull registry.cn-hangzhou.aliyuncs.com/waluna/kube-scheduler:[鏡像版本號]
crictl pull registry.cn-hangzhou.aliyuncs.com/waluna/kube-scheduler:[鏡像版本號]
關於我
全網可搜《阿賢Linux》
CSDN、知乎、嗶哩嗶哩、博客園、51CTO、掘金、思否、開源中國、阿裡雲、騰訊雲、華為雲、今日頭條、百家號、GitHub、個人博客
公眾號:阿賢Linux
個人博客:blog.waluna.top
https://blog.waluna.top/
原文鏈接: docker鏡像倉庫hub.docker.com無法訪問-解決辦法.