在 Docker build 的時候出現 DNS 相關的錯誤
  • 1,137 views,
  • 2023-07-19,
  • 上傳者: Kuann Hung,
  •  0
不知道大家有沒有遇過類似的狀況,就明明網路是通的,DNS 也是對的,但就是會出現下列的錯誤
#0 74.44 W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal/InRelease  Temporary failure resolving 'archive.ubuntu.com'
#0 74.44 W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-updates/InRelease  Temporary failure resolving 'archive.ubuntu.com'
#0 74.44 W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-backports/InRelease  Temporary failure resolving 'archive.ubuntu.com'
#0 74.44 W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease  Temporary failure resolving 'security.ubuntu.com'
 
6bfae0d2839ca1f9cf8dfb87ac85796e.png
 
這時候可以簡單地用這個方式,指定用 host 的網路,避開相關的問題喔
docker build --network=host  . -t your-image-name
訪客如要回應,請先 登入
    資料夾 :
    發表時間 :
    2023-07-19 13:40:15
    觀看數 :
    1,137
    發表人 :
    Kuann Hung
    部門 :
    老洪的 IT 學習系統
    QR Code :