title: Cannot docker-compose from behind a proxy
body: <p>I am trying to use <code>docker-compose build</code> behind a corporate proxy, but for some reason none of the areas where you insert the proxy settings seem to allow it to complete the steps.</p>
  
  <p>I am using a CentOS 8 server.</p>
  
  <p>The error message:</p>
  
  <pre><code>[root@centos8server docker]# docker-compose build
      postgres uses an image, skipping
      start_dependencies uses an image, skipping
      Building custom-docker
  
      Step 1/15 : FROM swift:5.2.3 as builder
      ---&gt; 67a9c8f156c1
  
      Step 2/15 : ARG env
      ---&gt; Using cache
      ---&gt; b767ab90fbe8
  
      Step 3/15 : RUN apt-get -qq update &amp;&amp; apt-get install -y   libssl-dev zlib1g-dev   &amp;&amp; rm -r /var/lib/apt/lists/*
      ---&gt; Running in b935c12d0bbd
      W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease  Temporary failure resolving 'archive.ubuntu.com'
      W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease  Temporary failure resolving 'archive.ubuntu.com'
      W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease  Temporary failure resolving 'archive.ubuntu.com'
      W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease  Temporary failure resolving 'security.ubuntu.com'
      W: Some index files failed to download. They have been ignored, or old ones used instead.
  
      Reading package lists...
      Building dependency tree...
      Reading state information...
      E: Unable to locate package libssl-dev
  
      ERROR: Service 'custom-docker' failed to build: The command '/bin/sh -c apt-get -qq update &amp;&amp; apt-get install -y   libssl-dev zlib1g-dev   &amp;&amp; rm -r /var/lib/apt/lists/*' returned a non-zero code: 100
  </code></pre>
  
  <p>My initial thought was that the CentOS server was using <code>apt</code> and <code>apt-get</code> which doesn't exist, but I then built the server at home without proxy restrictions at it just worked. I can <code>wget</code> the addresses and have no issues there.</p>
  
  <p>I have tried adding proxies in the following areas:</p>
  
  <p><strong>1. <a href="https://medium.com/@airman604/getting-docker-to-work-with-a-proxy-server-fadec841194e#002b" rel="nofollow noreferrer">proxy for build and compose</a></strong></p>
  
  <p>Except I didn't have a <code>.docker</code> folder in any of the user accounts so I created the directory and file</p>
  
  <pre><code>nano ~/.docker/config.json
  {
      "proxies": {
          "default": {
              "httpProxy": "http://proxy.server:port",
              "httpsProxy": "http://proxy.server:port",
              "noProxy": "localhost,127.0.0.1"
          }
      }
  }
  </code></pre>
  
  <p><strong>2. <a href="https://stackoverflow.com/a/28093517/1086990">Proxy for environment</a></strong></p>
  
  <p><strong>3. <a href="https://stackoverflow.com/a/25424638/1086990">Proxy for sysconfig</a></strong></p>
  
  <p>The only thing I do know that has been an issue in the past is our proxy is Basic-Auth but haven't been able to find out how to add that or if it is necessary to add in.</p>