以下内容复制自:传送门 ,可以直接去该地址查看。

HTTP/HTTPS proxy

The Docker daemon uses the HTTP_PROXYHTTPS_PROXY, and NO_PROXY environmental variables in its start-up environment to configure HTTP or HTTPS proxy behavior. You cannot configure these environment variables using the daemon.json file.

This example overrides the default docker.service file.

If you are behind an HTTP or HTTPS proxy server, for example in corporate settings, you need to add this configuration in the Docker systemd service file.

  1. Create a systemd drop-in directory for the docker service:

    $ sudo mkdir -p /etc/systemd/system/docker.service.d
  2. Create a file called /etc/systemd/system/docker.service.d/http-proxy.conf that adds the HTTP_PROXY environment variable:

    [Service]
    Environment="HTTP_PROXY=http://proxy.example.com:80/"

    Or, if you are behind an HTTPS proxy server, create a file called /etc/systemd/system/docker.service.d/https-proxy.conf that adds the HTTPS_PROXY environment variable:

    [Service]
    Environment="HTTPS_PROXY=https://proxy.example.com:443/"
  3. If you have internal Docker registries that you need to contact without proxying you can specify them via the NO_PROXYenvironment variable:

    [Service]
    Environment="HTTP_PROXY=http://proxy.example.com:80/" "NO_PROXY=localhost,127.0.0.1,docker-registry.somecorporation.com"

    Or, if you are behind an HTTPS proxy server:

    [Service]
    Environment="HTTPS_PROXY=https://proxy.example.com:443/" "NO_PROXY=localhost,127.0.0.1,docker-registry.somecorporation.com"
  4. Flush changes:

    $ sudo systemctl daemon-reload
  5. Restart Docker:

    $ sudo systemctl restart docker
  6. Verify that the configuration has been loaded:

    $ systemctl show --property=Environment docker
    Environment=HTTP_PROXY=http://proxy.example.com:80/

    Or, if you are behind an HTTPS proxy server:

    $ systemctl show --property=Environment docker
    Environment=HTTPS_PROXY=https://proxy.example.com:443/

为Docker容器设置http代理的更多相关文章

  1. docker 容器 设置网络代理

    以/bin/bash 形式进入容器: [设置http 及https代理],如下: export http_proxy=http://172.16.0.20:3128 export https_prox ...

  2. 利用pipework为docker容器设置固定IP

    今天介绍如何在redhat/centos7系列机器上使用pipework为docker启动的容器指定一个固定ip,我们知道默认情况下,docker会使用 bridge网络模式为每一个启动的容器动态分配 ...

  3. 为Docker容器设置静态IP

    此文已由作者袁欢授权网易云社区发布. 欢迎访问网易云社区,了解更多网易技术产品运营经验. 创建docker容器 docker run -it --name=yh -h yh --net=none de ...

  4. 为docker容器设置独立ip

    docker 1.12使用新版macvlan设置与宿主机同网段ip ****************************************** 由于开发的一些特殊需求,需要将容器部署在与宿主 ...

  5. windows宿主机和docker容器设置挂载共享文件夹

    docker容器内的程序经常需要访问.调用宿主机目录中的数据,每次都要导入导出非常麻烦费力. 接下来,一步步实现将宿主机的指定文件夹挂载到docker容器中. 1. 打开Oracle VM Vitua ...

  6. 转:为Docker容器设置固定IP实现网络联通(1)——通过Pipework为Docker容器设置

    https://blog.csdn.net/chinagissoft/article/details/51250839 1. 创建并启动一个容器: docker run --cap-add=NET_A ...

  7. 正在运行中的docker容器设置自动重启

    # demo : 你的容器名称 docker update –-restart=always demo

  8. docker容器怎么设置开机启动

    https://my.oschina.net/lwenhao/blog/1923003 docker服务器.以及容器设置自动启动 一.docker服务设置自动启动 说明:适用于yum安装的各种服务 查 ...

  9. 6.Docker容器底层实现了解与安全机制

    原文地址: 点击直达 0x00 底层实现 我们以 Docker 基础架构来探究Docke底层的核心技术,简单的包括: Linux 上的命名空间(Namespaces) 控制组(Control grou ...

随机推荐

  1. layer.js弹出框

    HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF- ...

  2. PTA之简单阶乘计算

    本题要求实现一个计算非负整数阶乘的简单函数. 时间限制: 400ms 内存限制: 64MB 代码长度限制: 16KB 函数接口定义: int Factorial( const int N ); 其中N ...

  3. centos7 编译安装php 5.6

    https://www.cnblogs.com/37yan/p/6879404.html

  4. [NOI2012]骑行川藏(未完成)

    题解: 满分又是拉格朗日啥的 以后再学 自己对于n=2猜了个三分 然后对拍了一下发现是对的

  5. 【spring基础】spring声明式事务详解

    一.spring声明式事务 1.1 spring的事务管理器 spring没有直接管理事务,而是将管理事务的责任委托给JTA或相应的持久性机制所提供的某个特定平台的事务实现.spring容器负责事物的 ...

  6. 009 搭建Spark的maven本地windows开发环境以及测试

    在看完下面的细节之后,就会发现,spark的开发,只需要hdfs加上带有scala的IDEA环境即可.  当run运行程序时,很快就可以运行结束. 为了可以看4040界面,需要将程序加上暂定程序,然后 ...

  7. Linux 之 AT&T汇编语言 mov、add、sub指令、数据段

    mov指令的几种形式: mov 寄存器. 数据 mov ax,8888 mov 寄存器. 寄存器 mov bx,ax mov 寄存器. 内存单元 mov ax,[0] mov 内存单元.寄存器 mov ...

  8. 类的 __call__ 和__repr__ 方法

    __call__: 让类实例可以被调用: __str__ , __repr__ : 两个都能是类实例名能被打印,区别在于repr可在交互是直接打印类名不用加print

  9. 通过pyqt5实现俄罗斯方块游戏例子

    # *_* coding:utf-8 *_* # 开发团队:中国软件开发团队# 开发人员:Administrator# 开发时间:2019/3/17 2:13# 文件名称:RussiaBoard# 开 ...

  10. 在Macos下完美解决Adobe Dreamweaver CC 2018 汉化及操作方法

    1.先关闭Dreamweaver,打开Finder进入应用程序,找到“Adobe Dreamweaver CC 2018”目录展开,移除“zh_CN”目录或者更名: 2.下载附件的汉化语言包解压,把解 ...