Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docs for printing the generated admin.password #116

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ In addition to the Universal Base Image, we can build images based on:

* Our [system requirements](https://help.sonatype.com/display/NXRM3/System+Requirements) should be taken into account when provisioning the Docker container.
* Default user is `admin` and the uniquely generated password can be found in the `admin.password` file inside the volume. See [Persistent Data](#user-content-persistent-data) for information about the volume.

> A simple way to print the password is the follwoing:
ahmed-musallam marked this conversation as resolved.
Show resolved Hide resolved
> - After the nexus3 contaier is finished running, run `docker ps --filter "ancestor=sonatype/nexus3"`
ahmed-musallam marked this conversation as resolved.
Show resolved Hide resolved
> it will print a list of containers, find your container and copy the `CONTAINER ID`
> - Run `docker container exec -it <CONTAINER ID> cat /nexus-data/admin.password && echo`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason that the previous command is not combined with this one? I don't have a test environment handy, but I'm imagining something like:
docker container exec -it $(docker ps --filter "ancestor=sonatype/nexus3" | awk '{print $1}') cat /nexus-data/admin.password && echo

Copy link
Author

@ahmed-musallam ahmed-musallam Mar 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wwannemacher The main reason is if a user is running multiple containers based on the same image. But I do not mind combining the commands :)
The goal is for users to get this generated password easily.

What would be perfect: Allow users to supply a param with the docker run command like: docker run <> -e SHOW_ADMIN_PASSWORD=true (naming things is hard), and the container would print the admin password in the logs. Is that something I can contribute and you think would be beneficial ?

Copy link
Member

@collinpeters collinpeters Mar 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wwannemacher Seems reasonable. Unlikely that folks have more than one running I would assume. Though note the default output has the column headers so I suggest to use -q to just get the container id. Another suggestion is to just use the container name.
docker container exec -it $(docker ps -q --filter "name=nexus3") cat /nexus-data/admin.password && echo

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ahmed-musallam - this is something that should happen at the operational level, not the application level. What you have here is good. Thanks for the contribution!

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ahmed-musallam FWIW, I'm totally stealing your approach for printing the generated admin password and adding it to the NXRM format archetype docs. Nice!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@collinpeters and @wwannemacher updated to use the suggested command, changed name to "nexus" though; because that's the name you use at the top of this doc.

>
> if my `CONTAINER ID` was `1951dfd68025`, I'd run `docker container exec -it 1951dfd68025 cat /nexus-data/admin.password && echo`

* It can take some time (2-3 minutes) for the service to launch in a
new container. You can tail the log to determine once Nexus is ready:
Expand Down