title: Docker Private Registry: connection refused
body: <p>Unable to connect to local docker repo.</p>
  <p>Here is the docker compse file:</p>
  <pre><code>version: '3'
  services:
    registry:
      restart: always
      image: registry:2
      container_name: registry
      ports:
      - &quot;5000:5000&quot;
      environment:
        REGISTRY_AUTH: htpasswd
        REGISTRY_AUTH_HTPASSWD_REALM: Registry Realm
        REGISTRY_AUTH_HTPASSWD_PATH: /home/user/auth/registry.password
        REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY: /data
      volumes:
        - ./data:/data
  </code></pre>
  <p>I get the following error when I run <code>docker login localhost:5000</code> :</p>
  <pre><code>&gt; Error response from daemon: Get http://localhost:5000/v2/: dial tcp [::1]:5000: connect: connection refused
  </code></pre>
  <p>Note that: <code>/home/user/auth/registry.password</code> file exist</p>