问题描述:Ubuntu想添加Docker官方的GPG密钥,命令输完无响应
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
测试网络,无问题
$ ping www.baidu.com
64 bytes from 183.232.231.172: icmp_seq=1 ttl=55 time=55.2 ms
单独输入,报错 Resolving failed: Temporary failure in name resolution,发现是DNS解析异常
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg
Resolving failed: Temporary failure in name resolution
查看resolv.conf配置的DNS,无此文件可以新建
$ cat /etc/resolv.conf
nameserver 192.168.1.1
nameserver 192.168.0.1
添加谷歌的name server
nameserver 8.8.8.8
nameserver 8.8.4.4
再次添加GPG密钥成功
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
OK
网友评论