GitLab container registry "denied: requested access to the resource is denied"
Short answer
GitLab's container registry gives Docker a token only for the actions you're allowed, so "denied: requested access to the resource is denied" means a push or pull got none. Check that the image name starts with a project's full path, such as registry.gitlab.com/group/project, plus at most two more levels; that you ran docker login against the registry's host, not Docker Hub; that you have at least the Developer role to push; and that your token has write_registry and read_registry; fine-grained tokens can't push images. The registry must also be on for the project. In CI, CI_REGISTRY_PASSWORD is the job token, which pushes only to the job's own project. "denied: access forbidden" means GitLab got no credentials that cover the registry: a token without a registry scope, or no login for that host.
A push to the GitLab container registry stops before the first layer uploads:
The push refers to repository [registry.gitlab.com/my-group/nginx]
5f70bf18a086: Preparing
denied: requested access to the resource is denied
For each push or pull, Docker asks GitLab for a token, and GitLab grants only the actions you’re allowed on the project the image name points to. When it grants nothing, the registry answers “denied”. Here are the causes in GitLab 19.5, the login errors that come first, and the ones in CI jobs.
Check these first
- The image name starts with a project’s path. An image lives under a project,
registry.gitlab.com/<group>/<project>, plus at most two more levels, as in.../my-project/api/worker:1.0.registry.gitlab.com/my-group/nginxis denied whenmy-group/nginxisn’t a project, and so is a typo. Deploy › Container Registry shows your project’s image path; in CI, use$CI_REGISTRY_IMAGE. - You’re logged in to the registry’s host.
docker loginwithout an address signs in to Docker Hub. Sign in toregistry.gitlab.com, or your instance’s registry address, which can differ from GitLab’s own, such asregistry.example.comorgitlab.example.com:5050. Without a login, a push to a public project gets this error, and one to a private or internal project getsdenied: access forbidden. - Your role is Developer or higher. Pushing needs Developer, Maintainer or Owner. Pulling from a private project needs at least Reporter.
- Your token can push. Legacy personal access tokens and project and group access tokens need
write_registryandread_registry, orapi; deploy tokens needwrite_registryandread_registry. A token with onlyread_registrysigns in, then gets denied on push. A fine-grained personal access token can’t push images at all, whatever its permissions. A project or group access token also needs the Developer role or higher. - The registry is on for the project, under Settings › General › Visibility, project features, permissions › Container registry. When it’s off, every push and pull is denied.
On GitLab.com Free, a private top-level group with more than five users, counting its subgroups and projects, becomes read-only, and image pushes are blocked until it’s back under the limit.
Push from a CI job
build-image:
image: docker:24.0.5-cli
services:
- docker:24.0.5-dind
variables:
DOCKER_TLS_CERTDIR: "/certs"
script:
- echo "$CI_REGISTRY_PASSWORD" | docker login "$CI_REGISTRY" -u "$CI_REGISTRY_USER" --password-stdin
- docker build -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA" .
- docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA"
CI_REGISTRY_PASSWORDis the job token. It pushes only to the job’s own project, and stops working when the job ends. To push to another project, create a deploy token or access token there withwrite_registryandread_registry, store it as masked CI/CD variables, and log in with those.$CI_REGISTRY_IMAGEis lowercase. Docker rejects capitals with aninvalid reference formaterror saying the repository name must be lowercase, so build image names from it, not from$CI_PROJECT_PATH.- Daemon errors come before any of this: see Cannot connect to the Docker daemon.
Pull another project’s image in CI
When a job’s image or a service comes from another project’s registry, the runner pulls it with the job token, and the job fails with:
WARNING: Failed to pull image with policy "always": Error response from daemon: pull access denied for registry.example.com/path/to/project, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
- If the image’s project is private, its job token allowlist must include yours, under its Settings › CI/CD › Job token permissions. Public and internal projects’ images need no allowlist, unless their registry is set to Only Project Members. More in CI_JOB_TOKEN access to another project.
- The user who started the pipeline must be a member of a private project that hosts the image, with at least the Reporter role. Bot users are often the ones missing. A runner that already cached the image can make it work for some users and fail for others.
- A project access token reaches only its own project, so it can’t pull another project’s images. Use a deploy token from the project that hosts them, or a group access token.
- GitLab 18.11.0 and 18.11.1 broke job-token pulls from public and internal projects, with this same error. 18.11.2 fixed it.
A pull of a Docker Hub image that fails with toomanyrequests is a different problem, Docker Hub’s pull limit: see GitLab CI and Docker Hub rate limits.
Login errors and “access forbidden”
unauthorized: HTTP Basic: Access denied. The password is wrong, or the account uses two-factor authentication, where only a token works, or the token is wrong or expired. More in HTTP Basic: Access denied.denied: access forbidden, at login or on a push. GitLab got no credentials that cover the registry: the token has no registry scope, so give itread_registry, pluswrite_registryto push, or Docker sent none, because you didn’t log in to this host. On GitLab Self-Managed, a proxy that strips theAuthorizationheader causes it too.Access denied: too many failed authentication attempts from this network. Repeated failures got your network blocked for a while. Wait, or sign in from another network.
Large images: “authentication required”
unauthorized: authentication required
When a long push ends with this, the registry token expired before the push finished. It lasts 15 minutes on GitLab.com and 5 minutes by default on GitLab Self-Managed, where an administrator can make it longer. Push a smaller image, or from a faster connection.
Protected repositories and tags
Pushing to protected repository path forbidden. A rule under Settings › Packages and registries › Container registry › Protected container repositories sets a Minimum access level for push above your role. Deploy tokens can’t push to a protected repository at all.- Protected container tags set a minimum role, Maintainer or higher, for pushing tags that match a pattern, such as
^v.*. - Immutable tags, on Ultimate, stop anyone from overwriting a matching tag once it exists. Push a new tag instead.
On your phone
MergeBell shows a job’s log live, so a build job’s denied line is there as soon as the runner writes it, and Retry reruns the job on the free tier. A retry is enough after a Maintainer fixes your role, the job token allowlist or a protection rule; a wrong image name in .gitlab-ci.yml needs a new commit. Tokens and registry settings need GitLab in a browser. More in how to retry a failed GitLab pipeline.
Frequently asked questions
Why does docker push to GitLab say "denied: requested access to the resource is denied"?
GitLab's registry grants only the actions you're allowed on the project the image name points to, and the push got none. The usual causes: the image name doesn't start with an existing project's path, your role is below Developer, your token lacks write_registry or is a fine-grained token, which can't push images, the container registry is off for the project, or a CI job is pushing to a different project. A push to a public project without docker login for that host fails this way too.
What name does an image need in the GitLab container registry?
It must start with the registry address and a project's full path, such as registry.gitlab.com/my-group/my-project, and can add up to two more levels, such as registry.gitlab.com/my-group/my-project/api/worker:1.0. A group path alone isn't a project, so registry.gitlab.com/my-group/nginx is denied. In CI, build names from $CI_REGISTRY_IMAGE, which is already lowercase.
Why does docker login to GitLab fail with "HTTP Basic: Access denied" or "access forbidden"?
"HTTP Basic: Access denied" means GitLab rejected the credentials: a wrong password, an account with two-factor authentication, which needs a token instead, or a wrong or expired token. "denied: access forbidden", at login or on a push, means GitLab got no credentials that cover the registry: give the token the read_registry scope, plus write_registry to push, or run docker login for the registry's host.
Can a GitLab CI job push to another project's container registry?
Not with its own credentials: CI_REGISTRY_PASSWORD is the job token, and it pushes only to the project the job runs in. To push elsewhere, create a deploy token or access token in the other project with read_registry and write_registry, store it as masked CI/CD variables, and log in with it. Pulling from another project does work with the job token: from a private project, once its job token allowlist includes yours and the user who started the pipeline is a member there.
Why does a large docker push to GitLab fail with "unauthorized: authentication required"?
The registry token expired before the push finished. It lasts 15 minutes on GitLab.com and 5 minutes by default on GitLab Self-Managed, where an administrator can make it longer. Push a smaller image or from a faster connection.
Sources
- GitLab docs — Authenticate with the container registry
- GitLab docs — Naming convention for your container images
- GitLab docs — Failed to pull image messages
- GitLab docs — Protected container repositories
- GitLab docs — Roles and permissions
- GitLab source — the container registry's token service
Checked against these pages on 5 November 2026. GitLab changes quickly — if something here no longer matches, tell us and we will fix it.
Do this from your phone with MergeBell
Free for the whole review loop: the To-Do inbox, diffs and line comments, approve and merge, pipelines with retry, and push alerts for your To-Dos. Works with gitlab.com and self-managed GitLab 16.0+.
Get MergeBell for iPhoneGet MergeBell for Android
On the App Store for iOS 26 or later and on Google Play for Android 12 or later. An independent app, not affiliated with GitLab Inc.