天天看點

win10下 docker build 報錯 “Failed to fetch xxxxxxxx Temporary failure resolving 'archive.ubuntu.com'”

錯誤資訊

在docker中搭建禅道的時候執行

docker build -t zentao ./

指令後執行到

apt-get update && apt-get install

指令的時候報錯,錯誤如下:

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease  Temporary failure resolving 'security.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
           

截圖如下:

win10下 docker build 報錯 “Failed to fetch xxxxxxxx Temporary failure resolving 'archive.ubuntu.com'”
解決辦法

windows docker desktop (19+版本)

如圖,給配置中添加如下配置,應用并重新開機

win10下 docker build 報錯 “Failed to fetch xxxxxxxx Temporary failure resolving 'archive.ubuntu.com'”

linux版本docker 配置/etc/docker/daemon.json檔案的DNS屬性

具體參考

(1)Docker daemon及容器執行個體的DNS配置詳解

(2)docker build 時運作apt-get update 時出現Temporary failure resolving ‘security.ubuntu.com’

(3)Docker配置檔案daemon.json解析