Configuration

# Registry

Where images are pushed and how dash logs in to do it.

The default registry is Docker Hub, but you can change it using `registry/server`.

## Using a local container registry

If the registry server starts with `localhost`, dash will start a local Docker registry on that port and push the app image to it.

```yaml
registry:
  server: localhost:5555
```

## Using Docker Hub as the container registry

By default, Docker Hub creates public repositories. To avoid making your images public, set up a private repository before deploying, or change the default repository privacy settings to private in your [Docker Hub settings](https://hub.docker.com/repository-settings/default-privacy).

A reference to a secret (in this case, `DASH_REGISTRY_PASSWORD`) will look up the secret in the local environment:

```yaml
registry:
  username:
    - <your docker hub username>
  password:
    - DASH_REGISTRY_PASSWORD
```

## Using AWS ECR as the container registry

You will need to have the AWS CLI installed locally for this to work. AWS ECR’s access token is only valid for 12 hours. In order to avoid having to manually regenerate the token every time, you can use ERB in the `deploy.yml` file to shell out to the AWS CLI command and obtain the token:

```yaml
registry:
  server: <your aws account id>.dkr.ecr.<your aws region id>.amazonaws.com
  username: AWS
  password: <%= %x(aws ecr get-login-password) %>
```

## Using GCP Artifact Registry as the container registry

To sign into Artifact Registry, you need to [create a service account](https://cloud.google.com/iam/docs/service-accounts-create#creating) and [set up roles and permissions](https://cloud.google.com/artifact-registry/docs/access-control#permissions). Normally, assigning the `roles/artifactregistry.writer` role should be sufficient.

Once the service account is ready, you need to generate and download a JSON key and base64 encode it:

```shell
base64 -i /path/to/key.json | tr -d "\\n"
```

You'll then need to set the `DASH_REGISTRY_PASSWORD` secret to that value.

Use the environment variable as the password along with `_json_key_base64` as the username. Here’s the final configuration:

```yaml
registry:
  server: <your registry region>-docker.pkg.dev
  username: _json_key_base64
  password:
    - DASH_REGISTRY_PASSWORD
```

## Validating the configuration

You can validate the configuration by running:

```shell
dash registry login
```

> **Note:** Generated from the gem's `lib/dash/configuration/docs/registry.yml` — the same reference `dash docs registry` prints in your terminal, so this page always matches your installed version.