1.准备
- 一台可以上网的centos7服务器并安装有docker
2.查找镜像
docker search nexus
3.选取第一个镜像拉取
docker pull sonatype/nexus3
4.查看拉取的镜像
docker images
5.启动nexus镜像
docker run -p 5000:5000 -p 8081:8081 --name nexus \
--restart=always \
-v /opt/nexus-data:/nexus-data \
-d --hostname nexus sonatype/nexus3
- 默认密码 : admin/admin123
- 参数解释
5000端口是用于镜像仓库的服务端口
8081 端口是nexus的服务端口
6.查看容器日志
docker logs nexus
Nexus 3.x 镜像权限问题
- 问题
[root@localhost opt]# docker logs nexus
mkdir: cannot create directory '../sonatype-work/nexus3/log': Permission denied
mkdir: cannot create directory '../sonatype-work/nexus3/tmp': Permission denied
Java HotSpot(TM) 64-Bit Server VM warning: Cannot open file ../sonatype-work/nexus3/log/jvm.log due to No such file or directory
Warning: Cannot open log file: ../sonatype-work/nexus3/log/jvm.log
Warning: Forcing option -XX:LogFile=/tmp/jvm.log
Unable to update instance pid: Unable to create directory /nexus-data/instances
/nexus-data/log/karaf.log (No such file or directory)
Unable to update instance pid: Unable to create directory /nexus-data/instances
- 解决方法
#将目录权限归属设定为 200
chown -R 200 /opt/nexus-data/
最新的Nexus 3.x还支持Docker仓库
- 当才华还配不上野心,就静下来学习
- blog地址:https://starsea.51vip.biz