Use case: allow to pull selected (e.g. tagged as *-public
) Docker Images anonymously. Otherwise credentials are required.
Given: latest Nexus 3.52.0, it works with a docker login
and LDAP credentials without issues.
Tried:
- Selector + Privilege + Role (all named docker-images-public) > given to use "anonymous", "Anonymous Access" enabled, with same user and Local Authorizing Realm.
- Result: Error response from daemon: Get https://HOST/v2/infrastructure/IMAGE/manifests/VERSION-public: no basic auth credentials Expected: ability to docker pull images, that match content selector (e.g. ".*-public")
Additionally tried:
enabling TRACE log level in log
Result: a lot of output, but without specific reason for denial (at least I didn't see). One of strings:
DEBUG [qtp194038341-106] *UNKNOWN org.sonatype.nexus.repository.view.Router - Response: Response{status=Status{successful=false, code=401, message='null'}, payload=StringPayload{size=113, charset=UTF-8, contentType='application/json'}}
without Nginx in front (e.g. docker pull HOST:5000/IMAGE:VERSION-public, via HTTP)
Result: same. Reason: seen StackOverflow answers mentioning Auth header modification. Wanted to exclude Nginx from equation completely.
simplyfing selector
Selector is
format == "docker" && ( path == "/v2/" || path =~ ".*public" || path == "/v2/.*")
Selector was modified in few attempts, including advise from https://stackoverflow.com/questions/43354352/nexus-docker-and-restricting-access-via-content-selector (most probably not ) However, the error is not about selector, as the error stays the same even withformat == "docker" && path =~ ".*"
Giving
anonymous
usernx-admin
roleResult: same error, so the reason is not in
anonymous
permissionsActivating
Docker Bearer Token Realm
, as per https://help.sonatype.com/repomanager3/nexus-repository-administration/formats/docker-registry/docker-authenticationResult: same error
Enabling Anonymous access on Repository level (checkbox "Allow anonymous docker pull ( Docker Bearer Token Realm required )")
Result: whole repository can be be accessed anonymously. Will NOT do.
The only other alternative here I see is to create a separate docker repository on different port ONLY for public anonymous access.