---
title: '`glab artifact-registry login`'
stage: AI Coding
group: Code Review
info: To determine the technical writer assigned to the Stage/Group associated with this page, see <https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments>
---

<!--
This documentation is auto generated by a script.
Please do not edit this file directly. Run `make gen-docs` instead.
-->

Authenticate a package manager against the GitLab Artifact Registry. (EXPERIMENTAL)

## Synopsis

Configure a package manager to authenticate against the GitLab Artifact
Registry, using a short-lived access token exchanged from your GitLab
session.

With `--docker`, glab is registered as a Docker credential helper
for the registry, and Docker exchanges a fresh token on every pull or
push, so `--duration` does not apply.

Use `--registry` only for a registry the Artifact Registry
actually backs. The credential helper prefers the artifact registry
token and falls back to `container_registry_domains` only
when that exchange fails, so a container registry listed here gets an
artifact registry token it rejects on every pull.

Docker runs that credential helper as its own subprocess, which reads
your credentials from the configuration file and ignores
`GITLAB_TOKEN`. This command verifies the login the same way, so
run `glab auth login` first if no token is stored for the host.

This feature is an experiment and is not ready for production use.
It might be unstable or removed at any time.
For more information, see
<https://docs.gitlab.com/policy/development_stages_support/>.

```plaintext
glab artifact-registry login [flags]
```

## Examples

```console
# Configure Docker to authenticate against a registry
glab artifact-registry login --docker --registry registry.example.com

```

## Options

```plaintext
      --docker              Configure Docker to authenticate against the registry. Writes to $DOCKER_CONFIG, or ~/.docker when it is unset.
      --duration duration   How long the exchanged token should remain valid. Ignored for now: --docker is the only tool this command configures, and its credential helper mints a fresh token for every request.
      --hostname string     GitLab hostname to request the token from. Defaults to the configured GitLab instance.
      --registry string     Bare hostname of the registry to authenticate against.
```

## Options inherited from parent commands

```plaintext
  -h, --help   Show help for this command.
```
