Nexus3 是什么

Nexus Repository Manager 3(简称Nexus3),是一款具有通用格式支持的免费存储库管理器。
Nexus3 支持存储和发布 Maven/Java, npm, NuGet, Helm, Docker, P2, OBR, APT, GO, R, Conan 等组件。
本文介绍如何使用 docker compose 搭建 Nexus3 服务。

docker compose 文件

services:
  nexus3:
    container_name: nexus3
    image: sonatype/nexus3
    ports:
      - 8081:8081
    volumes:
      - ./nexus-data:/nexus-data

服务器性能要求

因 Nexus3 是 java 实现,所以对服务器有一定的性能需求,这里是文档

根据文档以及默认配置,建议最少是4C4G的机器运行服务,但笔者测试2C3G也能正常运行。各位如果使用的话需要自行测试。

启动运行

在当前目录创建持久化存储目录,目录中可存储配置,日志,第三方模块存储等

该目录供 Nexus3 进程写入,需要 UID 200 权限,所以创建目录后需要修改权限

# mkdir nexus-data; chown -R 200 nexus-data

启动 Nexus3 服务,观察服务日志

# docker compose up -d; docker compose logs -f

当看到日志输出下面的内容时,说明服务已经成功启动

nexus3  | -------------------------------------------------
nexus3  | 
nexus3  | Started Sonatype Nexus OSS 3.69.0-02
nexus3  | 
nexus3  | -------------------------------------------------

查看初始密码

# cat nexus-data/admin.password

得到初始密码后,就能通过端口8081访问 Nexus3 服务,并使用帐号admin以及上述得到的初始密码进行登陆

参考文档

Nexus3 官网
Nexus3 文档
Nexus3 仓库

Last modification:June 11, 2024
If you think my article is useful to you, please feel free to appreciate