欢迎访问 生活随笔!

生活随笔

当前位置: 首页 >

【Docker】 安装 nexus3

发布时间:2024/9/19 63 豆豆
生活随笔 收集整理的这篇文章主要介绍了 【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)。

指定参数

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 \ -e INSTALL4J_ADD_VM_PARAMS="-Xms512m -Xmx512m -XX:MaxDirectMemorySize=512m" \ -p 8081:8081 sonatype/nexus3:3.36.0
  • 占用内存512m

总结

以上是生活随笔为你收集整理的【Docker】 安装 nexus3的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。