不知道大家有沒有遇過類似的狀況,就明明網路是通的,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'
這時候可以簡單地用這個方式,指定用 host 的網路,避開相關的問題喔
docker build --network=host . -t your-image-name