Execute Nexus provisioning script in Dockerfile

133 views
Skip to first unread message

michal....@globallogic.com

unread,
Aug 27, 2018, 6:18:03 AM8/27/18
to Nexus Users

Hello,


I am trying to run provisioning .sh script for sonatype/nexus3 image:
https://hub.docker.com/r/sonatype/nexus3


This script can only be run when container is up & running. Is it possible to execute this script in Dockerfile/docker-compose? I was trying to run it using CMD command in Dockerfile but after script was executed the container Exited (correct behavior).

So is it possible to run nexus in background and then execute provisioning script using Dockerfile/docker-compose? Maybe I should override nexus3 image Dockerfile?


Thanks for help :slight_smile:

Mariska

unread,
Aug 29, 2018, 5:02:47 AM8/29/18
to Nexus Users
Why would you want to do that? And precisely which script do you want to run?

Our setup is through docker and ansible. I don't use docker-compose in production (and development) due to the limitations it still has. Ansible also has some good docker modules, which are based upon the same python modules as docker itself.

We create our own custom nexus3 image and use ansible scripts to deploy this in production. The ansible scripts contain post configuration steps for nexus.

michal....@globallogic.com

unread,
Aug 31, 2018, 5:38:53 AM8/31/18
to Nexus Users
Please, don't ask me "Why you want to do that?" - it my task in company :)

This is my scenario:

run: "docker run..." with nexus3 image, wait couple minutes and finally have provisioned image with new repositories. Provisioning is performed by bash script (with curl and Nexus Scripts API). 
I don't want to run container, copy provisioning script on it, enter container, wait and finally run script. I want to make provisioning as simple as possible (like using this single command "docker run...").
Reply all
Reply to author
Forward
0 new messages