当前位置: 首页 > article >正文

配置docker的proxy指向

因为网络原因,现在无法直接下载docker hub上的镜像,需设置通过proxy进行访问。

一、测试环境

在笔记本上启用了proxy软件,笔记本IP为192.168.253.1,proxy端口8888。搭建一台Linux虚拟机用于下载docker镜像,虚拟机IP:192.168.253.129

二、修改docker配置文件

修改虚拟机内docker配置文件/lib/systemd/system/docker.service,指向代理服务程序端口。

需要在Service小段中增加:

Environment="HTTP_PROXY=http://192.168.253.1:8888"
Environment="HTTPS_PROXY=http://192.168.253.1:8888"

如下:

[root@localhost ~]# vi /lib/systemd/system/docker.service
[root@localhost ~]# cat /lib/systemd/system/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target

[Service]
Type=notify
Environment="HTTP_PROXY=http://192.168.253.1:8888"
Environment="HTTPS_PROXY=http://192.168.253.1:8888"
EnvironmentFile=-/etc/sysconfig/docker
EnvironmentFile=-/etc/sysconfig/docker-storage
EnvironmentFile=-/etc/sysconfig/docker-network
Environment=GOTRACEBACK=crash

ExecStart=/usr/bin/dockerd $OPTIONS \
                           $DOCKER_STORAGE_OPTIONS \
                           $DOCKER_NETWORK_OPTIONS \
                           $INSECURE_REGISTRY
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process

[Install]
WantedBy=multi-user.target

三、重启服务进行验证

[root@localhost ~]# systemctl daemon-reload
[root@localhost ~]# systemctl restart docker             
[root@localhost ~]# docker pull minio/minio:latest       
latest: Pulling from minio/minio
55360c0b72d6: Pull complete 
f2f8f30a646a: Pull complete 
4fc5fcb7e9ca: Pull complete 
53140b7a7f04: Pull complete 
2b8c182be72c: Pull complete 
4363be478988: Pull complete 
de7c323e2901: Pull complete 
7eb10b7b511b: Pull complete 
3d82d69301e2: Pull complete 
Digest: sha256:cd04ea408e185cb50076ea1c3988d444119b19aaae15aab45387ccf14b2a2f86
Status: Downloaded newer image for minio/minio:latest
[root@localhost ~]# 

 可以看到,已能正常下载容器镜像,使用网络proxy也可参照配置。


http://www.kler.cn/news/314336.html

相关文章:

  • 【Proteus仿真】基于51单片机的L298N电机电速调节
  • 记录动态库项目仅生成了dll,未生成lib文件的问题
  • 深度学习02-pytorch-07-张量的拼接操作
  • 剖析Spark Shuffle原理(图文详解)
  • go 以太坊代币查余额
  • Python | Leetcode Python题解之第424题替换后的最长重复字符
  • 是德科技Keysight N4433D ECal模块 26.5GHz 4端口3.5毫米
  • 在python爬虫中xpath方式提取lxml.etree._ElementUnicodeResult转化为字符串str类型
  • RAG+Agent人工智能平台:RAGflow实现GraphRA知识库问答,打造极致多模态问答与AI编排流体验
  • 演示jvm锁存在的问题
  • Java集合(三)
  • Centos7安装chrome的问题
  • WebApi开发中依赖注入和RESTful 详解
  • OceanBase 的并发简述笔记
  • Navicate 链接Oracle 提示 Oracle Library is not loaded ,账号密码都正确地址端口也对
  • 【变化检测】基于ChangeStar建筑物(LEVIR-CD)变化检测实战及ONNX推理
  • php变量赋值javascipt变量
  • 13.面试算法-字符串常见算法题(二)
  • 【论文阅读】3D Diffuser Actor: Policy Diffusion with 3D Scene Representations
  • 人工智能与机器学习原理精解【25】
  • 【电路笔记】-运算放大器积分器
  • 数模方法论-整数规划
  • Python类及元类的创建流程
  • C#进阶-基于雪花算法的订单号设计与实现
  • [Python数据可视化] Plotly:交互式数据可视化的强大工具
  • 15.9 grafana-deployment-yaml讲解
  • 掌上高考爬虫逆向分析
  • [Python数据可视化]探讨数据可视化的实际应用:三个案例分析
  • lvs-nat模式实验详解
  • 【全网最全】2024年华为杯研赛A题成品论文获取入口(后续会更新)