Error response from daemon: Get https://registry.gitlab.com/v2/: unauthorized: authentication required

Trying to log into using docker login registry.gitlab.com but I keep getting Error response from daemon: Get https://registry.gitlab.com/v2/: unauthorized: authentication required using the same username and password I use to log into https://gitlab.com. Are there any upgrades going on that could be preventing me from logging in?

I am affected by this as well, with Docker 1.12.1.

I am affected by this, too. Here are some more data points:

Gitlab CE 8.12.2 registry with Docker. The client throws:

$ docker login hub.mark.local:4567
Username (mark): mark
Password:
Error response from daemon: Get https://hub.mark.local:4567/v2/: unauthorized: authentication required

… and docker logs -f gitlab shows:

==> /var/log/gitlab/registry/current <==
2016-09-29_19:46:01.33075 time="2016-09-29T19:46:01.330638954Z" level=warning msg="error authorizing context: authorization token required" environment=production go.version=go1.5.4 http.request.host="hub.mark.local:4567" http.request.id=e7869d59-7f6c-4110-983f-f6eba80e7f74 http.request.method=GET http.request.remoteaddr=5.5.5.5 http.request.uri="/v2/" http.request.useragent="docker/1.12.1 go/go1.6.3 git-commit/23cf638 kernel/4.4.0-21-generic os/linux arch/amd64 UpstreamClient(Docker-Client/1.12.1 \\(linux\\))" instance.id=075adf20-faed-4d3e-984f-f64b7c24dba2 service=registry version=v2.4.1
2016-09-29_19:46:01.33081 127.0.0.1 - - [29/Sep/2016:19:46:01 +0000] "GET /v2/ HTTP/1.0" 401 87 "" "docker/1.12.1 go/go1.6.3 git-commit/23cf638 kernel/4.4.0-21-generic os/linux arch/amd64 UpstreamClient(Docker-Client/1.12.1 \\(linux\\))"

==> /var/log/gitlab/nginx/gitlab_registry_access.log <==
5.5.5.5 - - [29/Sep/2016:19:46:01 +0000] "GET /v2/ HTTP/1.1" 401 87 "-" "docker/1.12.1 go/go1.6.3 git-commit/23cf638 kernel/4.4.0-21-generic os/linux arch/amd64 UpstreamClient(Docker-Client/1.12.1 \x5C(linux\x5C))"

==> /var/log/gitlab/gitlab-rails/production.log <==
Started GET "/jwt/auth?account=mark&client_id=docker&offline_token=true&service=container_registry" for 5.5.5.5 at 2016-09-29 19:46:02 +0000
Processing by JwtController#auth as HTML
  Parameters: {"account"=>"mark", "client_id"=>"docker", "offline_token"=>"true", "service"=>"container_registry"}
Filter chain halted as :authenticate_project_or_user rendered or redirected
Completed 401 Unauthorized in 82ms (Views: 0.3ms | ActiveRecord: 1.9ms)

8.12.3 has been release just a minute or two ago. It gives this message:

unauthorized: HTTP Basic: Access denied
You have 2FA enabled, please use a personal access token for Git over HTTP.
You can generate one at https://hub.mark.local/profile/personal_access_tokens

I’ve been able to log in using such a token, which solved the issue for me.

Super late response but for anyone having trouble with this: Don’t actually docker login to just registry.gitlab.com, you need your full container registry url. Also using sudo might help if your on linux and get permission denied.

1 Like

Hi,

I’m still getting this error:
Error response from daemon: Get https://registry-1.docker.io/v2/: unauthorized: incorrect username or password

128

I’m pretty new to GitLab, so not sure how to debug this.

1 Like

For me, the Access Token I generated only included the permissions:

For read (pull) access, read_registry.
For write (push) access, write_registry.

as the docs states. But it’s also needed Read API access.

2 Likes

Thanks for the tip! This solved it for me (adding Read API)

Try manual docker pull. it worked for me

This worked for me. Thank you