title: Connecting docker client to remote docker daemon over TLS
body: <h2>What I would like</h2>
  
  <p>I've installed docker on an Ubuntu (14.04) box by following <a href="https://docs.docker.com/engine/installation/linux/ubuntulinux/#adjust-memory-and-swap-accounting" rel="nofollow">these instructions</a>.</p>
  
  <p>I would like to do whatever configuration is necessary to <strong>securely</strong> connect to the docker daemon on this box from my laptop running OSX.</p>
  
  <pre><code># on my OSX laptop
  $ docker ps
  # lists docker containers running on my Ubuntu box
  </code></pre>
  
  <h2>What I've tried</h2>
  
  <p>I have already <a href="https://docs.docker.com/engine/installation/linux/ubuntulinux/#enable-ufw-forwarding" rel="nofollow">enabled UFW forwarding</a> (and set the port to <code>2376</code> since I am using TLS) and followed the <a href="https://docs.docker.com/engine/security/https/" rel="nofollow">instructions to protect the docker daemon socket via TLS</a>.</p>
  
  <p>I ran the <code>openssl</code> commands on my Ubuntu box since OSX is notorious for coming with a bad version of <code>openssl</code>. I then copied over (via <code>scp</code>) <code>ca.pem</code>, <code>cert.pem</code> and <code>key.pem</code> to my OSX laptop at <code>~/.docker</code>.</p>
  
  <p>I then <code>sudo service docker stop</code> and <code>docker daemon --tlsverify --tlscacert=ca.pem --tlscert=server-cert.pem --tlskey=server-key.pem -H=0.0.0.0:2376</code> on my Ubuntu box.</p>
  
  <p>Lastly on OSX I made sure to set the relevant docker environment variables:</p>
  
  <pre><code>export DOCKER_TLS_VERIFY=1
  export DOCKER_HOST=tcp://$HOST:2376
  export DOCKER_CERT_PATH=~/.docker
  </code></pre>
  
  <p>However, I keep getting <code>Cannot connect to the Docker daemon. Is the docker daemon running on this host?</code> a couple seconds after running <code>docker ps</code> on my laptop.</p>
  
  <p>One doubt I have is whether the <a href="https://docs.docker.com/engine/security/https/" rel="nofollow">TLS instructions</a> are meant for <strong>remote</strong> access at all, as the code shown seems to all be run on 1 machine.</p>