title: Getting "connection refused" when trying to access etcd from within a Docker container
body: <p>I am trying to access etcd from within a running Docker container. When I run</p>
  
  <pre><code>curl http://172.17.42.1:4001/v2/keys
  </code></pre>
  
  <p>I get</p>
  
  <pre><code>curl: (7) Failed to connect to 172.17.42.1 port 4001: Connection refused
  </code></pre>
  
  <p>I have four other hosts where this works fine, but every container on this machine has this problem. I'm really at a loss as to what's going on, and I don't know how to debug it.</p>
  
  <p>My etcd environment variables are</p>
  
  <pre><code>ETCD_ADVERTISE_CLIENT_URLS=http://10.242.10.2:2379
  ETCD_DISCOVERY=https://discovery.etcd.io/&lt;token_removed&gt;
  ETCD_INITIAL_ADVERTISE_PEER_URLS=http://10.242.10.2:2380
  ETCD_LISTEN_CLIENT_URLS=http://10.242.10.2:2379,http://127.0.0.1:2379,http://0.0.0.0:4001
  ETCD_LISTEN_PEER_URLS=http://10.242.10.2:2380
  </code></pre>
  
  <p>I can also access etcd from the host with</p>
  
  <pre><code>curl http://localhost:4001/v2/keys
  </code></pre>
  
  <p>So there seems to be some error when routing from the container out to the host. But I can't figure out what it is. Can anyone point me in the right direction?</p>