docker编译镜像时报registry-1.docker.io udp connection timeout错误

学习docker时编译docker build -t friendlyhello . 总是报registry-1.docker.io udp connection timeout错误
查找资料后得知,需要修改 /etc/docker/daemon.json文件。在此文件中追加

{
“dns”: [“your_dns_address”, “223.5.5.5”]
}
其中223.5.5.5为阿里DNS
然后重启docker服务 sudo service docker restart
再次运行docker build -t friendlyhello .后成功!
如果有http代理服务器的话,需要再Dockerfile文件中添加下列内容

# Set proxy server, replace host:port with values for your servers
ENV http_proxy host:port
ENV https_proxy host:port

参考资料 https://docs.docker.com/get-started/part2/#build-the-app

猜你喜欢

转载自blog.csdn.net/LFfootprint/article/details/85346412
今日推荐