Create a Docker repository via the API and allow anonymous pulls

935 views
Skip to first unread message

Patrick van der Velde

unread,
Nov 3, 2017, 3:13:52 AM11/3/17
to Nexus Users
Hi

JIRA issue 10813 (https://issues.sonatype.org/browse/NEXUS-10813) indicates that it is possible to allow anonymous pulls from a docker registry. When I manually configure the option that works just fine. I'm now trying to figure out how to set this option programmatically in my Chef recipe. I'm currently just calling the API like this:

     import org.sonatype.nexus.repository.storage.WritePolicy; repository.createDockerHosted('docker-production', 5000, 5001, 'docker_hosted_blob', true, true, WritePolicy.ALLOW_ONCE)

and

    repository.createDockerProxy('hub.docker.io','https://registry-1.docker.io', 'HUB', '',5020, 5021, 'docker_proxy_blob', true, true)

I'd like to set the option mentioned in 10813 for both of those repositories but I cannot find it in the code on https://github.com/sonatype/nexus-public. I assume it hasn't been updated with the internal repository yet so if anybody could give me suggestions as how to resolve this that would be appreciated.

With kind regards

Petrik

Danny Kulchinsky

unread,
Nov 3, 2017, 10:55:19 AM11/3/17
to Patrick van der Velde, Nexus Users
Hi,

You can check out the PR I submitted for the Nexus Ansible playbook, here - https://github.com/savoirfairelinux/ansible-nexus3-oss/pull/27

It extends the groovy script used by this playbook to enable anonymous pull from Docker hosted repos.

In essence, you need to set forceBasicAuth to false


Please also keep in mind that the Docker token bearer realm must be activated as well, a PR that handles this can be found here - https://github.com/savoirfairelinux/ansible-nexus3-oss/pull/26


Regrads,
Danny

--
You received this message because you are subscribed to the Google Groups "Nexus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users+unsubscribe@glists.sonatype.com.
To post to this group, send email to nexus...@glists.sonatype.com.
To view this discussion on the web visit https://groups.google.com/a/glists.sonatype.com/d/msgid/nexus-users/140e6499-145f-4a0c-820d-9e657c37fda3%40glists.sonatype.com.
For more options, visit https://groups.google.com/a/glists.sonatype.com/d/optout.

Patrick van der Velde

unread,
Nov 4, 2017, 12:57:42 AM11/4/17
to Nexus Users, petrikva...@gmail.com
Hi Danny

Awesome thanks for that. That worked!

regards

Petrik



On Saturday, November 4, 2017 at 3:55:19 AM UTC+13, Danny Kulchinsky wrote:
Hi,

You can check out the PR I submitted for the Nexus Ansible playbook, here - https://github.com/savoirfairelinux/ansible-nexus3-oss/pull/27

It extends the groovy script used by this playbook to enable anonymous pull from Docker hosted repos.

In essence, you need to set forceBasicAuth to false


Please also keep in mind that the Docker token bearer realm must be activated as well, a PR that handles this can be found here - https://github.com/savoirfairelinux/ansible-nexus3-oss/pull/26


Regrads,
Danny
On Fri, Nov 3, 2017 at 3:13 AM, Patrick van der Velde <petrikva...@gmail.com> wrote:
Hi

JIRA issue 10813 (https://issues.sonatype.org/browse/NEXUS-10813) indicates that it is possible to allow anonymous pulls from a docker registry. When I manually configure the option that works just fine. I'm now trying to figure out how to set this option programmatically in my Chef recipe. I'm currently just calling the API like this:

     import org.sonatype.nexus.repository.storage.WritePolicy; repository.createDockerHosted('docker-production', 5000, 5001, 'docker_hosted_blob', true, true, WritePolicy.ALLOW_ONCE)

and

    repository.createDockerProxy('hub.docker.io','https://registry-1.docker.io', 'HUB', '',5020, 5021, 'docker_proxy_blob', true, true)

I'd like to set the option mentioned in 10813 for both of those repositories but I cannot find it in the code on https://github.com/sonatype/nexus-public. I assume it hasn't been updated with the internal repository yet so if anybody could give me suggestions as how to resolve this that would be appreciated.

With kind regards

Petrik

--
You received this message because you are subscribed to the Google Groups "Nexus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users...@glists.sonatype.com.

Danny Kulchinsky

unread,
Nov 4, 2017, 1:16:08 PM11/4/17
to Patrick van der Velde, Nexus Users
Glad to hear it!

Cheers,
Danny

To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users+unsubscribe@glists.sonatype.com.

To post to this group, send email to nexus...@glists.sonatype.com.
Reply all
Reply to author
Forward
0 new messages