docker search nexus
检索 nexus
下载nexus镜像
docker pull docker.io/sonatype/nexus3
确保目录名称存在,不存在创建目录
mkdir -p /data/nexus/data
授权
chmod 777 -R /data/nexus/data
启动nexus
docker run -d -p 8081:8081 --name nexus --privileged=true -v /data/nexus/data:/nexus-data sonatype/nexus3
查看日志 表示成功
首次登录 需要查看密码
找到密码
cat /data/nexus/data/admin.password
修改密码 为禁用匿名
启动访问 出现连接异常
登录进去选择第3个 禁用 重启
配置从阿里云 maven库里面拉依赖
http://maven.aliyun.com/nexus/content/groups/public
配置打包到nexus私服中
maven setting.xml配置
username password 则为nexus登录的账号密码
<repositories>
<repository>
<id>nexus</id>
<name>Nexus Repository</name>
<url>http://192.168.1.6:8081/repository/public/</url>
</repository>
</repositories>
<!-- 配置远程发布到私服,mvn deploy -->
<distributionManagement>
<repository>
<id>releases</id>
<url>http://192.168.1.6:8081/repository/releases/</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<url>http://192.168.1.6:8081/repository/snapshots/</url>
</snapshotRepository>
</distributionManagement>