DEV Community

Cover image for Create a Nexus Repository with Windows Containers
Federico Navarrete
Federico Navarrete

Posted on • Edited on • Originally published at supernovaic.blogspot.com

3 2

Create a Nexus Repository with Windows Containers

Docker is an extremely powerful tool. You often build your own image using X image or X Linux distros like Ubuntu or Debian and this is great. However, from time to time, you might need to use Windows.

In our case, we have a Nexus repository running in Windows Server, and some time ago, we started to move everything to AWS.

Our first thought was to use the Nexus Docker Image, but the greatest challenge happened when we were not able to import the DB. Regardless of the configuration we chose, the repo started to crash repeatedly without a clear reason. We followed the tutorials, and nothing worked.

Our only option was to move the old VM to a new EC2, which was a bad deal since this would be our only EC2 because the rest was running in containers in ECS.

After a while, we thought of a new solution, we had heard about Windows Containers, something that is not so well-known. And this is the solution that we produced.


Step 1. Download your nexus copy.

https://www.sonatype.com/products/repository-oss-download


Step 2. Create a Dockerfile with the following configuration:

FROM mcr.microsoft.com/windows/nanoserver:1809
RUN mkdir "c:\\nexus"
WORKDIR c:/nexus
RUN mkdir sonatype-work
RUN mkdir nexus-3.36.0-01
COPY nexus-3.36.0-01 .
COPY sonatype-work .
WORKDIR c:/nexus/nexus-3.36.0-01/bin
EXPOSE 8081
CMD ["nexus.exe", "/run"]
Enter fullscreen mode Exit fullscreen mode

The first line downloads a copy of Windows Nano Server, which has the smallest footprint. And later, we configured the location that we wanted.

The number 3.36.0-01 represents our current version of the Nexus repo, it can change over the years.

And that's all that you need.

Now, something important to highlight, this solution doesn't show any logs for any reason and takes some time to run it the first time. So, if you start hitting: http://localhost:8081 in minute one, it might not work, it takes a while maybe 3 to 5 minutes.

Follow me on:

Personal LinkedIn YouTube Instagram Cyber Prophets Sharing Your Stories
Personal LinkedIn YouTube Instagram RedCircle Podcast RedCircle Podcast

sponsor me

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay