AWS EC2 환경이며 Ubuntu 22.04.1 LTS 버전 및 docker 20.10.18 버전에서 구성 진행을 했습니다. Private 구축이 조건이였기 때문에 Private Subnet에 EC2 구성을 했고 Route53과 ALB 연결을 사전 진행을 완료한 상태입니다.

Nexus3를 EC2에 구성 시 발생할 수 있는 일부 상황은 아래 페이지에서 확인이 가능합니다.

Nexus3 docker exited (137)

Nexus 데이터가 들어갈 디렉터리 생성을 합니다.

$ mkdir nexus-data
$ ls
nexus-data

Nexus container 생성

$ docker run --name nexus -d -p 5000:5000 -p 8081:8081 -v /nexus-data:/nexus-data -u root sonatype/nexus3
Unable to find image 'sonatype/nexus3:latest' locally
latest: Pulling from sonatype/nexus3
a96e4e55e78a: Pull complete
67d8ef478732: Pull complete
5dab04a94e74: Pull complete
f18da266a531: Pull complete
8eaab91b309d: Pull complete
9191b3fc4348: Pull complete
16516688603a: Pull complete
Digest: sha256:45e9800b160a6ae666f64cead6a6118c151f2fc2973f55
Status: Downloaded newer image for sonatype/nexus3:latest
2238bbd6e0e44f1d85e704ad6433b8e73

기동이 완료된 후 생성한 도메인으로 접속하면 메인 페이지 확인이 가능합니다.

Untitled

Sign in을 하기 위해서 버튼을 누르면 ID는 admin이지만 초기 패스워드는 도커로 구성한 내부에서 /nexus-data/admin.password 파일에서 확인이 가능합니다.

화면 캡처 2022-09-23 175832.png

docker 내부로 접속하기 위해서 nexus docker 정보를 다시 확인하고 접속해서 패스워드를 확인합니다.

$ docker ps
CONTAINER ID   IMAGE             COMMAND                  CREATED       STATUS       PORTS                                                                                  NAMES
351f64194d8f   sonatype/nexus3   "/opt/sonatype/nexus…"   2 hours ago   Up 2 hours   0.0.0.0:5000->5000/tcp, :::5000->5000/tcp, 0.0.0.0:8081->8081/tcp, :::8081->8081/tcp   nexus

$ docker exec -it nexus /bin/bash
[root@351f64194d8f sonatype]# cd sonatype-work
[root@351f64194d8f sonatype]# cd nexus3
[root@351f64194d8f nexus3]# ls
admin.password  blobs  cache  db  elasticsearch  etc  generated-bundles  instances  javaprefs  karaf.pid  keystores  lock  log  orient  port  restore-from-backup  tmp

[root@351f64194d8f nexus3]# cat admin.password
나만의 패스워드 확인