The docker mirror warehouse hub.docker.com cannot be accessed

Article directory

  • The docker mirror warehouse hub.docker.com cannot be accessed
    • 1 Introduce why dockerhub cannot be accessed
    • 2 solutions
      • 2.1 Using magic
      • 2.2 Use domestic image acceleration
        • 2.2.1 docker configuration:
        • 2.2.2 containerd configuration:
      • 2.3 Use the blogger’s personal mirror warehouse
        • 2.3.1 At present, there are the following mirror warehouses, which will be added in the future
        • 2.3.2 Usage
        • 2.3.3 Pull image
    • 3 summary

docker mirror warehouse hub.docker.com cannot be accessed

The main content of the article:

  • Introduce why dockerhub cannot be accessed
  • Solution

1 introduce why dockerhub cannot be accessed

Recently, many friends in the group have asked why they cannot access the Docker mirror warehouse, so I also tried to access it, but it turned out that I could not access it.

Please add picture description

Everyone’s first reaction was to give the wall, and it was terrible to be red through the ping test.

Please add picture description

In fact, the DNS is polluted, causing many users to lose access. As for what is DNS pollution, you can check it yourself. Here we mainly explain how to solve the problem that dockerhub cannot be accessed.

Please add picture description

2 Solutions

Due to the inaccessibility, it is extremely inconvenient for our operation and maintenance personnel and developers to use the docker image. However, we can use the following methods to solve this problem.

2.1 Using magic

(I won’t go into details here, everyone knows everything)

2.2 Use domestic image acceleration

Common domestic acceleration services:

  • HKUST mirror: https://docker.mirrors.ustc.edu.cn
  • NetEase: http://hub-mirror.c.163.com
  • Alibaba Cloud: https://.mirror.aliyuncs.com

Don’t talk nonsense, go directly to the order

2.2.1 docker configuration:

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["mirror acceleration address"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker

# example
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://eph8xfli.mirror.aliyuncs.com"] # This is the blogger's own Aliyun mirror acceleration address, you can replace it with your own
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker

Aliyun official website also has operating documents for different operating systems, you can check them yourself

https://help.aliyun.com/document_detail/60750.html?spm=a2c4g.348824.0.0.742fa42dEeTNYo

Please add picture description

2.2.2 containerd configuration:

Including K8S image acceleration

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"]

2.3 Use the blogger’s personal mirror warehouse

This mirror warehouse is in Alibaba Cloud, mainly including K8S-related mirrors. If you have any needs, you can contact the blogger to add relevant images.

The mirror is updated continuously and synchronously every day. Currently, there are 80+ warehouses, including new versions and commonly used mirror versions.

2.3.1 At present, there are the following mirror warehouses, which will be added in succession

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

2.3.2 How to use

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}
....

2.3.3 Pull mirror image

docker pull registry.cn-hangzhou.aliyuncs.com/waluna/kube-scheduler:[image version number]
crictl pull registry.cn-hangzhou.aliyuncs.com/waluna/kube-scheduler: [image version number]

3 Summary

I personally feel that using magic is the most convenient, but many students don’t know how to use magic. So you can choose to use domestic mirror acceleration (2.2 in this article) or blogger mirror warehouse (2.3 in this article) according to your favorite method.

Original link: The docker mirror warehouse hub.docker.com cannot be accessed.