Configuring a DockerHub Registry

You can host your container images on Docker Hub in case your cluster doesn’t provide a default registry.

You need to create an account on https://hub.docker.com/, then use the following command to configure Camel K during installation:

kamel install --registry docker.io --organization your-user-id-or-org --registry-auth-username your-user-id --registry-auth-password your-password

The --registry-auth-username and --registry-auth-password flags are used by the kamel CLI to create a Kubernetes secret that holds your credentials for authenticating against the Docker registry.

In the general case, the --registry-auth-server should be used ad it’s automatically set to https://index.docker.io/v1/. Depending on the publish strategy you are using you will need to adapt you credentials with the --registry-auth-server flag. Spectrum expect https://index.docker.io/v1/ while Jib expect docker.io.

Jib works with Docker Hub in API v2 out of the box while Spectrum needs some adaptations for it to work.

Alternative Methods

In some cases, you might already have a push/pull secret for Docker Hub in your current namespace. Or you can also decide to create it using kubectl, with the following command:

kubectl create secret docker-registry your-secret-name --docker-username your-user --docker-password your-pass

Another possibility is to upload to the cluster your entire list of push/pull secrets:

# First login to your registry and provide credentials
docker login
# Then create a secret from your credentials file (may contain passwords for other registries)
kubectl create secret generic your-secret-name --from-file ~/.docker/config.json

After you’ve created the secret, you can link it to Camel K during installation:

kamel install --registry docker.io --organization your-user-id-or-org --registry-secret your-secret-name

As with the default method, this depends on the publish strategy you are using. So make sure any credential contains the valid authentication servers: https://index.docker.io/v1/ for Spectrum and docker.io for Jib.