How to set up nexus3 in docker on debian

  devops

First, you can set up a mounted share drive from a NAS if you have one.

You have to use ID 200 if you do this, because docker runs as 200

mount -v -t cifs //nas.florida/pool2powervault12driveRaid/systemstuff/xen-servernamehere /mnt/nas -o vers=2.1,credentials=/etc/nas.credentials,uid=200

Nexus stuff:

# 9/15/2019

# install docker - do this first, then come back here.

# exit

# log back in again

 
# 1. Use a docker volume. Since docker volumes are persistent, a volume can be
# created specifically for this purpose. This is the recommended approach.
#
# docker volume create --name nexus-data
# docker run -d -p 8081:8081 --name nexus -v nexus-data:/nexus-data sonatype/nexus3
# OR
# 
# 2. use a local directory (advantage: can access it easily, change configs, back it up, etc)

# create dirs and set up permissions
sudo mkdir /mnt/nas/nexus-data && sudo chown -R 200 /mnt/nas/nexus-data

# here run the main nexus on 8081 and also on 8123 because you'll set up a "docker HTTP connector" later. Do this 8123 mapping now.
docker run -d -p 8081:8081 -p 8123:8123 --restart unless-stopped --log-opt max-size=3m --log-opt max-file=3 --name nexus -v /mnt/nas/nexus-data:/nexus-data sonatype/nexus3

# watch the logs
docker logs -f `docker ps --filter "name=nexus" -aq`

# Verify that Nexus is up and running via http
http://nexus.florida:8081

# Get your admin password
# To get your admin password, shell into the container

# shell in
docker exec -it `docker ps --filter "name=nexus" -aq` /bin/bash
 
# cat
cat /nexus-data/admin.password
# it's a long hash. login is "admin"
 
exit

# go to nexus, click on Sign in, log in as admin / long-hash-password, next, set new admin password