Search code examples
permissionswildcardnexusdocker-registrysonatype

Configure Sonatype Nexus 3 privileges for hosted docker registry namespace using wildcard


I have installed Sonatype Nexus 3 OSS with Hosted Repository for Docker (Private Registry for Docker). I want to have couple of users, which will be able to pull/push docker images, based on their permissions.

First way, how I can do it - is to create several hosted repositories for docker and then via Securiy -> Privileges use repository-view with such approach configure permissions based on exact repository:

username:   repository name:    permission:

user1       docker-internal-1   nexus:repository-view-:docker:docker-internal-1:read
user2       docker-internal-1   nexus:repository-view-:docker:docker-internal-1:add

user3       docker-internal-2   nexus:repository-view-:docker:docker-internal-2:read
user4       docker-internal-2   nexus:repository-view-:docker:docker-internal-2:add

This approach works, but it requires having multiple hosted repositories for docker.

My question will be - is it somehow possible to have one singe hosted repository for docker and then configure permissions, based on docker repository namespace?

So let's say I have a repository called docker-internal and then I have such permissions:

username:   repository name:    permission:

user1       docker-internal     nexus:repository-view-:docker:docker-internal/namespace1:read
user2       docker-internal     nexus:repository-view-:docker:docker-internal/namespace1:add

user3       docker-internal     nexus:repository-view-:docker:docker-internal/namespace2:read
user4       docker-internal     nexus:repository-view-:docker:docker-internal/namespace2:add

Unfortunately in Nexus 3 documentation I haven't found a way how I can do it with repository-view permissions, cause they only allow you to specify repository name, but no namespace. Then there is such thing as wildcard, which is described in Sonatype docs like "Wildcard -> These are privileges that use patterns to group other privileges." So I've tried to create some regex pattern like this:

nexus:repository-view:docker:docker-internal/namespace1:read

And unfortunately it doesn't work.


Solution

  • Based on answer from Sonatype Nexus support currently it's not possible to do it via wildcard and namespace in docker registry. So the only working way is to use separate docker repositories and repository-view permissions.