3.6 KiB
| url |
|---|
| /docs/self-hosted/latest/install/docker-registry/ |
Docker Registry
Gitpod builds Docker images during workspace startup. This enables custom Dockerfiles as part of your workspace config, but is also required for Gitpod itself to function. To this end, Gitpod requires a container registry where it can push the images it builds.
By default Gitpod ships with a built-in Docker registry. If you operate your own Docker registry (which we'd recommend in a production setting) you can use that one. You have the following options:
- Integrated docker registry: If not disabled, this docker registry is installed in a Kubernetes Pod as a dependency of Gitpod’s Helm chart. The docker registry requires a Kubernetes PersistentVolume. This registry is not recommended to be used for production.
- Own docker registry: Gitpod can connect to your own docker registry. Compared to its built-in counterpart this enables performance gains and access to otherwise private images.
This helm chart can either deploy its own registry (default but requires HTTPS certs) or use an existing one.
Configuration
To connect to an existing Docker registry, perform the following steps:
-
Create a file
values.docker-registry.yamlcontaining:components: imageBuilder: registryCerts: [] registry: # name must not end with a "/" name: eu.gcr.io/gpl-sh-kubeup-2 secretName: image-builder-registry-secret path: secrets/registry-auth.json workspace: pullSecret: secretName: image-builder-registry-secret docker-registry: enabled: falseReplace
your.registry.com/gitpodwith the domain your registry is available at. -
Login to the registry and safe the authentication
mkdir -p secrets docker login your.registry.com/gitpod && cp ~/.docker/config.json secrets/registry-auth.jsonThis does not work for Google Cloud Registries because their login tokens are short-lived. See the example below on how to configure it.
-
Do a
helm upgrade --install -f values.docker-registry.yaml gitpod .to apply the changes.
Make sure the resulting JSON file contains the credentials (there should be an auths section containing them as base64 encoded string).
If that's not the case you might have a credential store/helper set up (e.g. on macOS the Securely store Docker logins in macOS keychain setting).
Example Google Cloud Registry Credentials
Prerequisites:
gcloudinstalled and authenticated
How to use Google Cloud Registry as Docker registry for Gitpod:
-
Go to https://console.cloud.google.com/gcr/images/<your-project-id>?project=<your-project-id> and hit "Enable Registry API" (if not already enabled).
-
Execute the following commands:
export PROJECT_ID="<your-project-id>" gcloud iam service-accounts create gitpod-registry-full --project=$PROJECT_ID gcloud projects add-iam-policy-binding $PROJECT_ID --member="serviceAccount:gitpod-registry-full@$PROJECT_ID.iam.gserviceaccount.com" --role=roles/storage.admin gcloud iam service-accounts keys create gitpod-registry-full-key.json --iam-account=gitpod-registry-full@$PROJECT_ID.iam.gserviceaccount.com echo "{\"auths\":{\"gcr.io\": {\"auth\": \"$(echo -n "$(echo -n "_json_key:"; cat gitpod-registry-full-key.json)" | base64 -w 0)\"}}}" > secrets/registry-auth.json