sonatype / docker-nexus

Docker image for Sonatype Nexus
Other
383 stars 201 forks source link

How to pre-create a repo? #54

Closed Geekays closed 7 years ago

Geekays commented 7 years ago

I'm using this and it works well. However, first time I spin up the container, I need to login to Nexus and create the repository. Henceforth it is persistent.

Is there a way that I may be able to create at least one repository in the container so that wen I spin up, the repository is already there?

mrprescott commented 7 years ago

@Geekays look into the provisioning/scripting API. This will let you create repositories programmatically. There's an example script that creates a basic maven repository.

Geekays commented 7 years ago

@mrprescott Thanks for closing it promptly.

However, my requirement was little different than the way it is being answered. I know I can create the repo programmatically once the Nexus instance comes up. But what I was asking is having a default repository (of my choice) as part of the default instance. I was thinking if I could add something in the dockerfile to accomplish this, or being able to add a parameter to the docker run command when I bring this up.

joedragons commented 7 years ago

@Geekays As far as I know this cannot be done via NXRM without docker, so seems unlikely to me it'd be able to be done with docker (and thus https://issues.sonatype.org/projects/NEXUS/summary would be a better place for an improvement request). If you find a way, I'd be curious to know myself.