docker run报错

发布时间 2023-05-16 23:37:04作者: 钱塘江畔

1.背景

CentOS安装好docker后,测试时报错

[root@cloud ~]# docker run hello-world
Unable to find image 'hello-world:latest' locally
docker: Error response from daemon: Head "https://registry-1.docker.io/v2/library/hello-world/manifests/latest": dial tcp: lookup registry-1.docker.io on 192.168.1.1:53: no such host.
See 'docker run --help'.

2.步骤

# 新建daemon.json文件
sudo vim /etc/docker/daemon.json

# 添加以下内容
{
  "registry-mirrors": ["http://hub-mirror.c.163.com"]
}

# 重启docker
systemctl daemon-reload
sudo systemctl restart docker

3.引用

修改docker镜像源,解决docker: Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: re