Challenge, Easy,  on  Containers

Docker 101: Authenticate to Private Container Registries

Most real-world container registries are private - you can't pull from them or push to them without authenticating first. Even Docker Hub asks for credentials as soon as you start pushing your own images.

In this challenge, you'll work with two different private registries and practice authenticating to each one with the right credentials using docker login.

The setup:

  • dev-01 is your workstation with Docker installed.
  • ci.internal:5555 is your team's internal CI registry.
  • registry.iximiuz.com is a private registry your team uses to host images.

Each registry has its own credentials:

  • ci.internal:5555: username: developer, password: ci-pass-123
  • registry.iximiuz.com: username: iximiuzlabs, password: rules!

Pull a private image from registry.iximiuz.com

A build of acme/widget has been pre-published to registry.iximiuz.com/acme/widget:v1.2.0, but the registry won't serve it to anonymous users. Authenticate with registry.iximiuz.com and pull the image to dev-01's local Docker daemon.

Hint 1

Try docker pull registry.iximiuz.com/acme/widget:v1.2.0 first - the error message should hint at what's missing.

Hint 2

The docker login command authenticates with a registry and stores the credentials locally so that subsequent pulls and pushes can reuse them:

docker login <registry-domain>

If you don't pass a registry, Docker defaults to Docker Hub (docker.io) - make sure to specify the registry domain you want to authenticate against (registry.iximiuz.com). After login, docker pull from the same registry should work.

Login to ci.internal:5555

ci.internal:5555 is a separate, internal registry your team uses for CI artifacts. It accepts a different username and password than registry.iximiuz.com, so you need a separate docker login for it.

Push the image to ci.internal:5555

Now that the local Docker daemon is authenticated against the CI registry, re-tag the previously pulled image and push it to ci.internal:5555/acme/widget:v1.2.0.

Hint 3

The recipe is the standard docker tag + docker push:

docker tag <existing-tag> <new-tag>
docker push <new-tag>

The push uses the credentials saved by the previous docker login automatically, matching the right credentials for the target registry (the domain part of the image reference).

Container image name format visualized: registry domain, repository path, tag, and digest.