1、取运行镜像
docker pull sonatype/nexus3
mkdir -p /home/nexus/data
chown -R 200 /home/nexus/data
docker run -d -p 8081:8081 --name nexus --restart=always -v /home/nexus/data:/nexus-data sonatype/nexus3:latest
2、访问
ip+端口
Nexus 的默认管理员账号 admin
,密码 在映射出来的位置cat /home/nexus/dataadmin.password
3、Repositories 说明
Nexus 默认已经创建好了 Nuget 以及其他的仓库,并且是创建了3个不同类型的仓库:nuget-group、nuget-hosted、nuget.org-proxy。
nuget.org-proxy:类型是 proxy,表示代理仓库。我们向它请求包(package)的时候,如果本地有,它就从本地提供,如果本地没有,它会从 nuget.org 下载到本地,然后给我提供这个包。
nuget-hosted:类型是 hosted,表示托管仓库。我们一般把自己开发的包上传到该仓库中。
nuget-group:类型是 group,表示仓库组,它结合了 nuget.org-proxy 和 nuget-hosted ,能对外提供上述两者中的包。
小结:
nuget-hosted 负责包上传,nuget.org-proxy 负责代理从 nuget.org 下载包到 Nexus 缓存中,nuget-group 负责提供包。一般使用 nuget-group 提供的 URL 就可以了,它可以把私服和公共库进行合并。