【Docker】 安装 nexus3

【Docker】 安装 nexus3,第1张

【Docker】 安装 nexus3 前言
  • CentOS Linux release 7.9.2009 (Core)
  • Docker version 1.13.1
准备
  • docker 已安装。
  • 选择合适的nexus3 镜像(这里使用:sonatype/nexus3:3.36.0)。
拉取镜像
shell> docker pull sonatype/nexus3:3.36.0
Trying to pull repository docker.io/sonatype/nexus3 ... 
3.36.0: Pulling from docker.io/sonatype/nexus3
262268b65bd5: Pull complete 
06038631a24a: Pull complete 
50539d8bb585: Pull complete 
c85fea177c04: Pull complete 
6f4fa3a69090: Pull complete 
Digest: sha256:f7c805f51a44dc55163dc05525c96dc845c6cff58572c3cc02af00dfb9a111ba
Status: Downloaded newer image for docker.io/sonatype/nexus3:3.36.0

查看拉取的镜像

shell> docker images
REPOSITORY                  TAG                 IMAGE ID            CREATED             SIZE
docker.io/sonatype/nexus3   3.36.0              8e82bd6e4710        3 weeks ago         656 MB
docker.io/hello-world       latest              feb5d9fea6a5        2 months ago        13.3 kB

创建但不运行容器
shell> mkdir -p /data/nexus1/data && chown -R 200 /data/nexus1/data
shell> docker create --restart=always --name nexus1 
-v /data/nexus1/data:/nexus-data 
-p 8081:8081 sonatype/nexus3:3.36.0
  • chown -R 200 /data/nexus1/data:/data/nexus1/data的目录所有者是用户200。
  • --restart=always: 自动运行
  • -v /data/nexus1/data:/nexus-data: 将宿主机的/data/nexus1/data挂载成容器的/nexus-data目录
运行容器
shell> docker start nexus1

查看日志

shell> docker logs -f nexus1

查看容器运行状态

shell> docker ps
ConTAINER ID        IMAGE                    COMMAND                  CREATED             STATUS              PORTS                    NAMES
565a2c6bbecf        sonatype/nexus3:3.36.0   "sh -c ${SONATYPE_..."   4 minutes ago       Up 4 minutes        0.0.0.0:8081->8081/tcp   nexus1
打开Nexus

http://localhost:8081/

登录Nexus

Nexus 提示密码:Your admin user password is located in /nexus-data/admin.password on the server.

查看密码:

shell> cat /data/nexus1/data/admin.password
b199a989-d81f-3f51-bebc-b78f6ae3e5d1

点击Nexus页面的右上角进行登录,通过初始用户名和密码进行登录(admin/b199a989-d81f-3f51-bebc-b78f6ae3e5d1)。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5596801.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-15
下一篇 2022-12-15

发表评论

登录后才能评论

评论列表(0条)

保存