make docker報錯 Temporary failure resolving解決方法

make docker 時執行到命令RUN apt-get update && apt-get install -y netcat && rm -rf /var/cache/apt 時出現以下錯誤

Err:1 http://security.ubuntu.com/ubuntu xenial-security InRelease
  Temporary failure resolving 'security.ubuntu.com'
Err:2 http://archive.ubuntu.com/ubuntu xenial InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Err:3 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Err:4 http://archive.ubuntu.com/ubuntu xenial-backports InRelease
  Temporary failure resolving 'archive.ubuntu.com'

網上大多的解決方案是修改/etc/resolv.conf ,添加nameserver。
在我的測試環境上實際上是不好使的。

修改以下文件

sudo vim  /etc/default/docker
將 DOCKER_OPTS前的#去掉,使
DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4" 生效。

重啓docker

sudo service docker restart

然後重新執行 make docker 。

發佈了44 篇原創文章 · 獲贊 15 · 訪問量 1萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章