zoukankan      html  css  js  c++  java
  • 为Docker容器设置http代理

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

    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/
  • 相关阅读:
    hbase-15-如何查看HFile
    Hbase-14-MemStore Flush的触发时机
    Hbase-13-MemStore
    【c++】C++中erase的用法
    Redis五种数据结构(转载)
    redis的三种集群方式 (转载)
    hbase和hive的差别是什么,各自适用在什么场景中?(转载)
    vue 数据已经更新了但是页面未更新
    uni-app配置跨域
    覆盖 web-view (uni-app)
  • 原文地址:https://www.cnblogs.com/flying607/p/10233210.html
Copyright © 2011-2022 走看看