目录
1.拉取nexus3镜像
root@123:~# docker pull sonatype/nexus3
Using default tag: latest
latest: Pulling from sonatype/nexus3
26f1167feaf7: Pull complete
adffa6963146: Pull complete
e88dfbe0ef6a: Pull complete
0d43c5e95446: Pull complete
8ff7b45a7e29: Pull complete
Digest: sha256:eff4fb12346ceb5cd424732ee9f2765c0db0f8d5032cdb2f7f7e17acc349f651
Status: Downloaded newer image for sonatype/nexus3:latest
docker.io/sonatype/nexus3:latest
2.启动nexus3
docker run \
-d \
--restart always \
--name nexus3 \
-p 8081:8081 \
-v /usr/local/docker/nexus3:/var/nexus-data \
sonatype/nexus3
服务器内存不多时, 可限制内存大小
docker run \
-d \
--restart always \
--name nexus3 \
-p 8081:8081 \
--privileged=true \
-e INSTALL4J_ADD_VM_PARAMS="-Xms512M -Xmx512M -XX:MaxDirectMemorySize=512M" \
-v /usr/local/docker/nexus3:/var/nexus-data \
sonatype/nexus3
3.登入nexus可视化页面
进入容器查看密码
root@123:~# docker exec -it nexus3 /bin/bash
bash-4.4$ cd nexus-data/
bash-4.4$ ls
admin.password cache db elasticsearch etc generated-bundles instances karaf.pid keystores lock log orient port restore-from-backup tmp
bash-4.4$ cat admin.password
58f0260a-15bf-4e6a-b672-84028de32037
页面地址 ip:8081
点击登录
输入 账号:admin 密码:cat admin.password的结果
登录进来后会让设置新的密码