Images in public docker repositories report: unauthorized: authentication required
Summary
I have a GitLab EE instance (on trial, to buy full license in 2018) and any Docker Repository in a public project in a public group are not accessible without authentication.
Note: The group has been renamed in the past.
Steps to reproduce
Create an empty public project in a publicly visible repository. Build an image in docker-in-docker scenario:
variables:
DEBIAN_FRONTEND: noninteractive
LC_ALL: C
DOCKER_DRIVER: overlay2
stages:
- build
.image: &image
image: docker:latest
stage: build
services:
- docker:dind
tags:
- docker
before_script:
- docker info
script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_JOB_TOKEN" "$CI_REGISTRY"
- docker pull "$CI_REGISTRY_IMAGE/$CI_JOB_NAME" || true
- docker build --cache-from "$CI_REGISTRY_IMAGE/$CI_JOB_NAME" -t "$CI_REGISTRY_IMAGE/$CI_JOB_NAME" "docker/$CI_JOB_NAME"
- docker push "$CI_REGISTRY_IMAGE/$CI_JOB_NAME"
only:
- master
- triggers
- tags
bind9/debian-amd64:stable:
<<: *image
-
Build the image(s)
-
Install
docker-cefrom official repositories at a client computer
$ docker --version
Docker version 17.09.1-ce, build 19e2cf6
- Try pulling the image without logging in
Example Project
The full project can be seen here:
https://gitlab.isc.org/isc-projects/images
What is the current bug behavior?
When trying to pull image unauthenticated, the following error message is shown:
$ docker pull registry.gitlab.isc.org/isc-projects/images/bind9/debian-amd64:stable
Error response from daemon: unauthorized: authentication required
What is the expected correct behavior?
- image pulled
Relevant logs and/or screenshots
- Here's the strange thing - nothing shows neither in the
nginx/gitlab_registry_*.lognotregistry/currentlog files, only following logs are affected:
==> /var/log/gitlab/gitlab-workhorse/current <==
2017-12-19_08:26:22.60095 registry.gitlab.isc.org @ - - [2017-12-19 03:26:22.571790628 -0500 EST] "GET /v2/ HTTP/1.1" 302 111 "" "docker/17.09.1-ce go/go1.8.3 git-commit/19e2cf6 kernel/4.9.0-3-amd64 os/linux arch/amd64 UpstreamClient(Docker-Client/17.09.1-ce \\(linux\\))" 0.029003
--
==> /var/log/gitlab/nginx/gitlab_access.log <==
2001:19f0:5001:962:5400:1ff:fe35:fd0a - - [19/Dec/2017:03:26:22 -0500] "GET /v2/ HTTP/1.1" 302 111 "" "docker/17.09.1-ce go/go1.8.3 git-commit/19e2cf6 kernel/4.9.0-3-amd64 os/linux arch/amd64 UpstreamClient(Docker-Client/17.09.1-ce \x5C(linux\x5C))"
--
==> /var/log/gitlab/gitlab-workhorse/current <==
2017-12-19_08:26:23.23112 registry.gitlab.isc.org @ - - [2017-12-19 03:26:23.178238248 -0500 EST] "GET /users/sign_in HTTP/1.1" 200 12301 "https://registry.gitlab.isc.org/v2/" "docker/17.09.1-ce go/go1.8.3 git-commit/19e2cf6 kernel/4.9.0-3-amd64 os/linux arch/amd64 UpstreamClient(Docker-Client/17.09.1-ce \\(linux\\))" 0.052793
--
==> /var/log/gitlab/nginx/gitlab_access.log <==
2001:19f0:5001:962:5400:1ff:fe35:fd0a - - [19/Dec/2017:03:26:23 -0500] "GET /users/sign_in HTTP/1.1" 200 12329 "https://registry.gitlab.isc.org/v2/" "docker/17.09.1-ce go/go1.8.3 git-commit/19e2cf6 kernel/4.9.0-3-amd64 os/linux arch/amd64 UpstreamClient(Docker-Client/17.09.1-ce \x5C(linux\x5C))"
--
==> /var/log/gitlab/gitlab-workhorse/current <==
2017-12-19_08:26:23.84984 registry.gitlab.isc.org @ - - [2017-12-19 03:26:23.80581293 -0500 EST] "GET /v2/isc-projects/images/bind9/debian-amd64/manifests/stable HTTP/1.1" 401 61 "" "docker/17.09.1-ce go/go1.8.3 git-commit/19e2cf6 kernel/4.9.0-3-amd64 os/linux arch/amd64 UpstreamClient(Docker-Client/17.09.1-ce \\(linux\\))" 0.043862
--
==> /var/log/gitlab/nginx/gitlab_access.log <==
2001:19f0:5001:962:5400:1ff:fe35:fd0a - - [19/Dec/2017:03:26:23 -0500] "GET /v2/isc-projects/images/bind9/debian-amd64/manifests/stable HTTP/1.1" 401 61 "" "docker/17.09.1-ce go/go1.8.3 git-commit/19e2cf6 kernel/4.9.0-3-amd64 os/linux arch/amd64 UpstreamClient(Docker-Client/17.09.1-ce \x5C(linux\x5C))"
Output of checks
Results of GitLab environment info
System information
System:
Proxy: no
Current User: git
Using RVM: no
Ruby Version: 2.3.5p376
Gem Version: 2.6.13
Bundler Version:1.13.7
Rake Version: 12.1.0
Redis Version: 3.2.5
Git Version: 2.13.6
Sidekiq Version:5.0.4
Go Version: unknown
GitLab information
Version: 10.2.4-ee
Revision: a93af19
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: postgresql
DB Version: 9.6.5
URL: https://gitlab.isc.org
HTTP Clone URL: https://gitlab.isc.org/some-group/some-project.git
SSH Clone URL: git@gitlab.isc.org:some-group/some-project.git
Elasticsearch: no
Geo: no
Using LDAP: no
Using Omniauth: yes
Omniauth Providers: gitlab
GitLab Shell
Version: 5.9.4
Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories
Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks
Git: /opt/gitlab/embedded/bin/git
Results of GitLab application Check
Checking GitLab Shell ...
GitLab Shell version >= 5.9.4 ? ... OK (5.9.4)
Repo base directory exists?
default... yes
Repo storage directories are symlinks?
default... no
Repo paths owned by git:root, or git:git?
default... yes
Repo paths access is drwxrws---?
default... yes
hooks directories in repos are links: ...
2/1 ... ok
6/2 ... ok
11/3 ... ok
11/4 ... ok
11/5 ... ok
13/6 ... ok
2/7 ... ok
Running /opt/gitlab/embedded/service/gitlab-shell/bin/check
Check GitLab API access: OK
Redis available via internal API: OK
Access to /var/opt/gitlab/.ssh/authorized_keys: OK
gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes
Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Checking Reply by email ...
IMAP server credentials are correct? ... yes
Init.d configured correctly? ... skipped
MailRoom running? ... skipped
Checking Reply by email ... Finished
Checking LDAP ...
LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab ...
Git configured correctly? ... yes
Database config exists? ... yes
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config up to date? ... yes
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory exists? ... yes
Uploads directory has correct permissions? ... yes
Uploads directory tmp has correct permissions? ... yes
Init script exists? ... skipped (omnibus-gitlab has no init script)
Init script up-to-date? ... skipped (omnibus-gitlab has no init script)
Projects have namespace: ...
2/1 ... yes
6/2 ... yes
11/3 ... yes
11/4 ... yes
11/5 ... yes
13/6 ... yes
2/7 ... yes
Redis version >= 2.8.0? ... yes
Ruby version >= 2.3.5 ? ... yes (2.3.5)
Git version >= 2.7.3 ? ... yes (2.13.6)
Git user has default SSH configuration? ... yes
Active users: ... 13
Elasticsearch version 5.1 - 5.5? ... skipped (elasticsearch is disabled)
Checking GitLab ... Finished
Edited by Ondřej Surý