On Docker Hub and other registries, Docker image are stored inside repositories. Individual repositories can be public and private within a single registry, yet the authentication is always for the entire registry. So when you want to use a private repository, you need to authenticate for the registry.

How to use private registries

To authenticate private repos, you need to provide the credentials to the registry containing the private repo. You can provide these through the Account > Private Repos page.

Alternatively, you can use our CLI tool, running sloppy docker-login. When you’re already logged in with docker, this option will save you some time. It also allows you to use other registries than Docker Hub and Quay.

sloppy docker-login will upload ~/.docker/config.json . This file is created when you use docker login and looks like the following:

{
        "auths": {
                "https://index.docker.io/v1/": {
                        "auth": "bWlrZW1pY345trh87ZXJzdHlsZTgxMSE="
                },
                "registry.gitlab.com": {
                        "auth": "bWlrZxb34rfdvhzuj97tDExIQ=="
                }
        }
}

Docker also supports storing credentials in separate stores, using the credsStore  option. In that case, the config.json  won't have the auth  properties, looking like this instead:

{
  "auths" : {
    "https://index.docker.io/v1/" : {},
    "my-registry.sloppy-agile.com" : {}
  },
  "credsStore" : "osxkeychain"
}

Our CLI is able to read from the credsStore  as well, so as long as you use sloppy docker-login, that still works fine.

How to use 3rd-party registries

Don't want to store your Docker images on Docker Hub? There are plenty alternatives. For an example, check out our blog post about using the GitLab container registry with sloppy.io.

Tags: private repositories, registries, Docker Hub, Quay, Quay.io

Did this answer your question?