title: Docker Hub login behind a proxy
body: <p>I recently installed Docker 18.04.0-ce on my Ubuntu 17.10 VM. While working behind a proxy I got stuck trying to log in into the Docker Hub registry. So when I run:</p>
  
  <pre><code>docker login -u &lt;username&gt; -p &lt;cool password&gt;
  </code></pre>
  
  <p>And I get this message:</p>
  
  <pre><code>Error response from daemon: Get https://registry-1.docker.io/v2/: net/http:  
  request canceled while waiting for connection (Client.Timeout exceeded while 
  awaiting headers)
  </code></pre>
  
  <p>As far as my understanding goes from the research I did is that when you are behind a proxy and you want to use Docker you need to configure it accordingly even though having set your environment variable like so:</p>
  
  <pre><code>http_proxy=&lt;my_proxy&gt;
  https_proxy=&lt;my_proxy&gt;
  HTTP_PROXY=&lt;my_proxy&gt;
  HTTPS_PROXY=&lt;my_proxy&gt;
  </code></pre>
  
  <p>Second, it looks like that Docker has multiple levels of proxy configurations meaning different configuration for build, containers, and the daemon.</p>
  
  <p>I went and configured all of those to match my proxy, but I still get that message. YES, I DID RESTART the service and the daemon.</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <pre><code>$ docker info
  
  Containers: 8
   Running: 0
   Paused: 0
   Stopped: 8
  Images: 12
  Server Version: 18.04.0-ce
  Storage Driver: overlay2
   Backing Filesystem: extfs
   Supports d_type: true
   Native Overlay Diff: true
  Logging Driver: json-file
  Cgroup Driver: cgroupfs
  Plugins:
   Volume: local
   Network: bridge host macvlan null overlay
   Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
  Swarm: inactive
  Runtimes: runc
  Default Runtime: runc
  Init Binary: docker-init
  containerd version: 773c489c9c1b21a6d78b5c538cd395416ec50f88
  runc version: 4fc53a81fb7c994640722ac585fa9ca548971871
  init version: 949e6fa
  Security Options:
   apparmor
   seccomp
    Profile: default
  Kernel Version: 4.13.0-39-generic
  Operating System: Ubuntu 17.10
  OSType: linux
  Architecture: x86_64
  CPUs: 1
  Total Memory: 7.79GiB
  Name: docker-vb
  ID: 447I:6DFI:JZ7V:F6SZ:BUCB:IFB2:4HGT:MXK2:Y5H5:EECC:FIQN:SZOH
  Docker Root Dir: /var/lib/docker
  Debug Mode (client): false
  Debug Mode (server): false
  HTTP Proxy: http://&lt;proxy_ip&gt;:&lt;proxy_port&gt;
  HTTPS Proxy: http://&lt;proxy_ip&gt;:&lt;proxy_port&gt;
  Registry: https://index.docker.io/v1/
  Labels:
  Experimental: false
  Insecure Registries:
   127.0.0.0/8
  Live Restore Enabled: false
  </code></pre>