以前的Dockerfile重新build时出现无法执行 apt-get update,在宿主机是可以的。
找到个攻略,docker build加上--network=host参数,临时解决!
第二种方法:
the problem was with Internet connection, as mine connection is at enterprise level and because of that It was unable to execute apt-get update command. Solution worked for me is :
find your DNS server address using cat /etc/resolv.conf
Open Docker confg file and uncomment DOCKER_OPTS and add your DNS server over there
Docker config file : sudo gedit /etc/default/docker
参考: