当前位置: 首页 > news >正文

docker run hello-world失败、报错

若终端输出类似以下信息,一般是docker镜像源未设置或有问题

Unable to find image 'hello-world:latest' locally
docker: Error response from daemon: Get "https://registry-1.docker.io/v2/": context deadline exceeded (Client.Timeout exceeded while awaiting headers).
See 'docker run --help'.

解决方案:

# 1. 停止 Docker 服务(避免占用)
sudo systemctl stop docker# 2. 修改配置文件,添加镜像源
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{"registry-mirrors": ["https://do.nark.eu.org","https://dc.j8.work","https://docker.m.daocloud.io","https://dockerproxy.com","https://docker.mirrors.ustc.edu.cn","https://docker.nju.edu.cn","https://docker.xuanyuan.me","https://mirror.ccs.tencentyun.com","https://mirror.huaweicloud.com","https://docker.1ms.run"]
}
EOF# 3. 重新加载系统配置,重启 Docker
sudo systemctl daemon-reload
sudo systemctl restart docker# 4. 查看 Docker 信息
docker info
# 终端输出的Registry Mirrors就是配置好的镜像源
Client: Docker Engine - CommunityVersion:    27.0.3Context:    defaultDebug Mode: false
...
...
...Registry Mirrors:https://do.nark.eu.org/https://dc.j8.work/https://docker.m.daocloud.io/https://dockerproxy.com/https://docker.mirrors.ustc.edu.cn/https://docker.nju.edu.cn/https://docker.xuanyuan.me/https://mirror.ccs.tencentyun.com/https://mirror.huaweicloud.com/https://docker.1ms.run/Live Restore Enabled: false# 5. 重新运行docker run hello-world
docker run hello-world
# 如果一切顺利,会输出以下信息
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
17eec7bbc9d7: Pull complete 
Digest: sha256:f7931603f70e13dbd844253370742c4fc4202d290c80442b2e68706d8f33ce26
Status: Downloaded newer image for hello-world:latestHello from Docker!
This message shows that your installation appears to be working correctly.To generate this message, Docker took the following steps:1. The Docker client contacted the Docker daemon.2. The Docker daemon pulled the "hello-world" image from the Docker Hub.(amd64)3. The Docker daemon created a new container from that image which runs theexecutable that produces the output you are currently reading.4. The Docker daemon streamed that output to the Docker client, which sent itto your terminal.To try something more ambitious, you can run an Ubuntu container with:$ docker run -it ubuntu bashShare images, automate workflows, and more with a free Docker ID:https://hub.docker.com/For more examples and ideas, visit:https://docs.docker.com/get-started/
http://www.dtcms.com/a/601500.html

相关文章:

  • 多媒体消息支持 - 全面提升系统对文字、图片、视频、文件和语音的处理能力
  • 重庆建设厅的网站首页o2o网站源码app
  • 2018年临沂建设局网站越秀seo搜索引擎优化
  • C++系列之刷题系列(树)
  • 07-ES分布式搜索引擎高级
  • NVIDIA Orin NX使用Jetpack安装CUDA、cuDNN、TensorRT、VPI时的error及解决方法
  • 青岐网站建设平台大气物流网站模块
  • 南昌营销网站公司全球优秀企业网站
  • 数据分析笔记03:概率分布理论
  • SpringCloud零基础学全栈,实战企业级项目完整使用
  • 扁平化设计网站欣赏网站做
  • 【开题答辩过程】以《基于SpringBoot+VUE的商场人流监控及分析系统的设计与实现》为例,不会开题答辩的可以进来看看
  • 网站登录不了哪里网站用vue.js做的
  • 网站备案审核通过时间品牌搜索
  • 孤能子视角:数字社会治理框架
  • C Primer Plus Notes 11
  • LangChain v1.0学习笔记(1)
  • [Linux]学习笔记系列 -- [kernel]ksysfs
  • 庆阳市建设局网站怎么设置iis默认网站
  • 前端安全展示后端纯文本接口数据的实践:不解析、不危险渲染的结构化方案
  • 【2024年莆田市校园创客节(小学组)初赛】泡泡堂
  • 河南省网站建设电脑网页
  • Doc-Researcher: 多模态文档深度研究系统的技术解析
  • E3Docker,一键解锁E3连接酶配体发现新纪元!
  • 【AI智能体】Coze 基于关键词生成古诗词 + 配图智能体操作详解
  • 百日挑战——单词篇(第二十天)
  • Vue 3组合式API中ref与reactive的核心响应式差异及使用最佳实践是什么?
  • 创意网站推荐智能手机网站模板
  • JAVA学习笔记——集合的概念和习题
  • 商城网站开发方案书导购类网站备案