最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

告別Docker請求超時之一步步排查與詳細(xì)解決方案

 更新時間:2025年02月08日 09:02:17   作者:Crime_man  
在Ubuntu系統(tǒng)上安裝Docker后,運(yùn)行docker?run?hello-world時遇到連接超時問題,下面這篇文章主要介紹了Docker請求超時一步步排查與詳細(xì)解決方案的相關(guān)資料,需要的朋友可以參考下

docker運(yùn)行系統(tǒng)

系統(tǒng):Ubuntu

問題現(xiàn)象

在ubuntu系統(tǒng)上面,安裝完Docker后,嘗試運(yùn)行 docker run hello-world 來測試docker安裝是否成功的時候,報(bào)錯,報(bào)錯信息如下:

docker: Error response from daemon: Get "https://registry-1.docker.io/v2/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers).
See 'docker run --help'.

解決方案

對于這種連接超時的問題,網(wǎng)上有很多的解決方案,我也根據(jù)網(wǎng)上的解決方案嘗試了,但是有些處理方案不起作用,也在下面處理方案列出,希望對你們有所幫助。

1. 修改docker鏡像源 (本地修改后不行)

使用命令 sudo vim /etc/docker/daemon.json (若文件不存在,會自動創(chuàng)建一個新的daemon.json文件),替換文件中的鏡像源信息

{
    "registry-mirrors": ["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"]
  }

修改后需重新docker服務(wù)

sudo systemctl daemon-reload
sudo systemctl restart docker

檢查是否生效:查看docker系統(tǒng)信息 docker info,查看 registry mirror 中剛配置的內(nèi)容地址。

2. 修改DNS服務(wù)配置

  • 查看DNS服務(wù)配置,/etc/resolv.conf
cat /etc/resolv.conf
  • 查看nameserver后面IP地址信息,或者顯示的IP地址有問題,可以嘗試修改該文件。
nameserver 114.114.114.114
nameserver 8.8.8.8

3. 獲取可用的鏡像源(成功拉取鏡像源)

以上方法都不起作用后,找了很久,終于找到一個可用的鏡像源

https://docker.rainbond.cc/

將上述信息添加到damon.json文件中,然后重啟服務(wù),docker run hello-world 嘗試?yán)$R像,成功。

Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
c1ec31eb5944: Pull complete 
Digest: sha256:d211f485f2dd1dee407a80973c8f129f00d54604d2c90732e8e320e5038a0348
Status: Downloaded newer image for hello-world:latest

Hello 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 the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share 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/

總結(jié):

在這篇博客中,提供了一系列處理Docker拉取鏡像超時的實(shí)用的解決方案。我們首先分析了網(wǎng)絡(luò)連接問題、DNS配置錯誤以及代理設(shè)置等可能導(dǎo)致該錯誤的因素。接著,我們詳細(xì)講解了如何通過調(diào)整Docker配置文件、修改DNS選項(xiàng)以及檢查系統(tǒng)代理設(shè)置等方法來解決這一問題。
通過這些步驟,相信你已經(jīng)能夠有效地解決“Client.Timeout exceeded while awaiting headers”錯誤,讓你的Docker容器順利運(yùn)行。掌握這些技巧,不僅能幫助你處理當(dāng)前的問題,也為你在未來面對類似挑戰(zhàn)時提供了有力的工具。

希望這篇教程對你有所幫助,助你在Docker的使用過程中更加得心應(yīng)手。謝謝閱讀,期待你的反饋!

到此這篇關(guān)于Docker請求超時排查與詳細(xì)解決方案的文章就介紹到這了,更多相關(guān)Docker請求超時排查與解決內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評論

社旗县| 泰顺县| 遂川县| 云梦县| 当阳市| 金门县| SHOW| 曲水县| 绥棱县| 宜兰市| 衡山县| 库伦旗| 北流市| 洛南县| 禄劝| 抚顺市| 黑山县| 盘山县| 六安市| 中江县| 桃江县| 莒南县| 兴山县| 如东县| 巧家县| 台中市| 荔波县| 云南省| 衡山县| 武穴市| 苗栗县| 咸丰县| 壶关县| 张掖市| 吴江市| 普宁市| 托克逊县| 曲周县| 古丈县| 广西| 沾益县|