检查Ubuntu是否设置了DNS,确保解析正常

Ubuntu DNS配置方法

interfaces方式
修改/etc/network/interfaces,配置DNS需要在该文件中加入

dns-nameserver xx.xx.xx.xx
dns-nameserver xxx.xxx.xx.xx
dns-nameservers xxx.xxx.xxx.xxx xxx.xxx.xx.xxx

•dns-nameserver: 指定一条DNS地址,如果需要指定多个DNS则需要使用添加多行。
•dns-nameservers: 指定多个DNS地址,用空格隔开。
需要重启电脑方可生效

resolvconf方式
修改DNS则是通过修改/etc/resolvconf/resolv.conf.d/base,在文件中加入

nameserver xxx.xxx.xx.xxx
nameserver xx.xx.xx.xx

•nameserver: 指定DNS地址,当有多个DNS记录时每个DNS记录占一行。

sudo resolvconf -u      #更新/etc/resolv.conf文件

Ubuntu 更换国内源

在天朝用外国的网址总是经历重重磨难,这里将国外源换为国内源,参考https://blog.csdn.net/shana_8/article/details/81482950
备份原来的源

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak1

更换源为阿里源

sudo gedit /etc/apt/sources.list

deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse  
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse  
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse  
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse  
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse  
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse  
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse  
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse  
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse  
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe
multiverse

更新源

sudo apt-get update

这时候你会发现docker pull正常了~

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐