Could not fetch/save url https://download.docker.com/linux/centos/docker-ce.repo to file /etc/yum.re

编程入门 行业动态 更新时间:2024-10-20 16:07:46

解决docker在代理下不能拉取镜像

解决方案

如下步骤执行即可,注意proxy的替换

#First, create a systemd drop-in directory for the Docker service:
mkdir /etc/systemd/system/docker.service.d
#Now create a file called /etc/systemd/system/docker.service.d/http-proxy.conf that adds the HTTP_PROXY environment variable:
# 换成自己的代理ip
[Service]
Environment="HTTP_PROXY=http://proxy.example:80/"
#If you have internal Docker registries that you need to contact without proxying you can specify them via the NO_PROXY environment variable:

Environment="HTTP_PROXY=http://proxy.example:80/"
Environment="NO_PROXY=localhost,127.0.0.0/8,docker-registry.somecorporation"

#Flush changes:
$ sudo systemctl daemon-reload

#Verify that the configuration has been loaded:
$ sudo systemctl show --property Environment docker
#output: Environment=HTTP_PROXY=http://proxy.example:80/

#Restart Docker:
$ sudo systemctl restart docker

更多推荐

Could not fetch/save url https://download.docker.com/linux/centos/docker-ce.repo

本文发布于:2023-06-14 07:14:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1450258.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:https   download   docker   fetch   save

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!