​ Nexus 是 Sonatype 开发的一款仓库管理系统,用于集中存储、管理和分发各种软件包与构建产物,如 Maven 依赖、npm 包、Python 包、Docker 镜像等。它可作为企业内部的私有仓库,加速构建、控制版本与权限,并支持代理公网仓库以实现统一依赖管理。相比 MinIO 这类通用对象存储,Nexus 专注于开发流程中的包与镜像管理,是 DevOps 环境中常用的制品仓库解决方案。

nexus部署

赋权

1
sudo chown -R 200:200 /opt/sonatype/sonatype-work

部署

1
2
3
4
5
6
7
docker run -d \
--name nexus \
-p 8081:8081 \
-p 5000:5000 \
-v /data/soft/nexus:/nexus-data \
-e TZ=Asia/Shanghai \
sonatype/nexus3:3.85.0

案例

私服docker Images mirror搭建

创建仓库

Settings->Repository->Repositories->Create repository

image-20251016162915883

image-20251016163530739

创建角色

Settings->Security->Roles

image-20251016163340131

image-20251016163409185

创建用户

Settings->Security->Users

image-20251016163000302

image-20251016163438378

赋权匿名用户拉取用户

image-20251016163550461

使用

修改daemon.json

1
2
3
4
{
"insecure-registries": ["192.168.99.203:5000"]
}

1
2
systemctl daemon-reload
systemctl restart docker

推送

1
2
3
docker login 192.168.99.203:5000
docker tag nginx:latest 192.168.99.203:5000/nginx:latest
docker push 192.168.99.203:5000/nginx:latest

image-20251016164004161

拉取

1
docker pull 192.168.99.203:5000/nginx:latest

image-20251016164057094