I'm having trouble pushing to GitLab Container Registry.
I can login successfully using my username and a personal access token but when I try to push the image to the registry, I get the following error:
$ docker push registry.gitlab.com/[groupname]/dockerfiles/nodemon
The push refers to a repository
[registry.gitlab.com/[groupname]/dockerfiles/nodemon]
15d2ea6e1aeb: Preparing
2260f979a949: Preparing
f8e848bb8c20: Preparing
740a5345706a: Preparing
5bef08742407: Preparing
denied: requested access to the resource is denied
I assume the issue is not with authentication because when I run a docker login registry.gitlab.com
, I get a Login Succeeded
message.
Where is the problem?
How should I push my images to GitLab Container Registry?
Recently, GitLab appear to have improved the granularity of their permission system. So if you want to push container images to the GitLab Docker registry, you can create a token merely with the read_registry and write_registry permissions.
Enable the personal access token by adding api scope as per this guidelines. After creating the token and username, use these credentials for logging into the Docker environment or pushing. Deploy tokens created under CI/CD setup is not sufficient for pushing the image to a Docker registry. Show activity on this post.
GITLAB Ubuntu 16.04 gitlabVM with Gitlab container with the following docker image gitlab/gitlab-ce:9.4.2-ce.0 docker version Docker version 17.06.0-ce, build 02c1d87 Target VM target machine where i need to pull,push images: CentOS Linux release 7.2.1511 (Core) docker version Docker version 1.12.1, build 23cf638
The main line that gives some clue about the root cause of this error is this one: Why do I say that? Because your GitLab repository is using HTTPS. It expects to have a secure connection between your system and your repository. Now, should it not be automatically using HTTPS? No!
I got it working by including api
scope to my personal access token.
The docs states The minimal scope needed is read_registry
. But that probably applies for read only access.
Reference: https://gitlab.com/gitlab-com/support-forum/issues/2370#note_44796408
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With