<iframe src="//www.googletagmanager.com/ns.html?id=GTM-TT8R4P" height="0" width="0" style="display:none;visibility:hidden">
Stay updated on the latest news from
the makers of Nexus
Docker Compose for Nexus Platform - Part 1
by Curtis Yanko on December 12, 2017

Tags: Docker, Nexus IQ, Nexus Repository 3

Since taking on a role where I help our partners learn how to install and use our solutions I've turned my focus to making that 'easy'. Now that Sonatype offers 'official' docker images for Nexus Repository Manager and Nexus Lifecycle they were a perfect fit for my use case. Tools like docker-compose can make starting and stopping our platform as simple as docker-compose up and docker-compose down. Docker does such a great job of masking a lot of complexity that even fairly non-technical folks have been able to successfully use these scripts.

I share my work in GitHub, like everyone else these day, at CMYanko/demo-iq-server. You can see from the name that this started out with a focus on our IQ Server but has grown into the full platform. Here you'll find some scripts and documentation on how to install and run our solutions quickly and easily. I assume you are working on a docker host, I find Docker for Mac works very well for me on my laptop. Docker for Mac makes it easy top set up how much system resources to allocate to the docker host. For this project you only need 1 CPU and 2GB of ram. Here you can see I'm currently using 3cpus and 8 GB of ram because I also play with oc-cluster up for a local OpenShift environment and mini-kube for a plain vanilla kubernetes environment.

docker-resources.png

Don't worry about the subnet or image location, those are all defaults for now. I do however really like how easy and obvious it is to configure the docker daemon though.

Now, if we take a look at the demo setup documentation we can see the prerequisites along with a script to run, demo-setup.sh (opportunity here for someone on a Windows machine to provide a .bat file too ;-). A closer look at demo setup shows us:

# Creates directories to be mounted to containers as volumes
mkdir ~/iq-data ~/nexus-data
cp -R ./nexus-ssl ~/nexus-ssl

# Stands up test environment
docker-compose up -d

The script makes the directories we're going to need for persistence, copies in a self-signed cert so we can get going and then runs the docker-compose command for us. The '-d' is to run it 'detached' from the terminal. To see the logging output I highly recommend also installing the Kitematic app of you can use docker by with this command: docker logs <container_name> which in our case is either iq-server or nexus3.

Once they are running you can use point your browser at http://localhost:8070 for the IQ Server or at http://localhost:8081 for Nexus Repository. 

We can see how these ports were defined in the docker-compose file plus other defined ports. For instance in the iq-server section you can see we've also defined the admin port at 8071 and in the Nexus Repo section I've already added 8443 for the SSL connection to the repo plus 18443 and 5000 for Docker proxy and private registry respectively. To get the Docker setup in NXRM you'll need to configure them manually for now but there is also an opportunity for us to add provisioning scripts as well.

To be clear, at the start of this article I talked about 'official' sonatype containers but the image I'm using for NXRM comes from our own bradbeck. That image essentialy does what the Using A Dockerized Nexus as a Docker Registry article walk you through. This is an example of how you can extend/enhance an existing image to fit your needs. In Part 2 I'll show how to customize the IQ Server image with a custom configuration.

You can configure NXRM (if you have a key to unlock Pro features and the IQ server) to point to the IQ server by configuring it to point to http://iq-server:8070. This takes advantage of Docker networking DNS, for that to work outside of docker you'll want to add an alias to your /etc/hosts file:

127.0.0.1 localhost  iq-server  <--- add additional aliases here

Now iq-server:8070 will resolve the name to you running container from your browser too.

While all of this is still a work a progress, what is there now has been very effective at helping folks get our platform running for demo environments, PoC's, training, etc.  I'll keep evolving this project to add an Nginx server to offload the SSL work and provide secure logins to both NXRM and the IQ Server and perhaps provisioning scripts to automatically configure the Docker proxy and private registry. Pull request welcome :-D

Stay tuned for Part 2 where I'll show how create your own iq-server image with a custom config.yml file and push it to a private registry in NXRM.

Recent Posts

Posts by Topic

see all

Get Blog Updates