微服务框架搭建系列: 2.搭建Nexus私服

搭建Nexus(需要1.5G内存)

由于微服务的架构思想,一台服务器提供一种服务,所以在VMWare上新开一台虚拟机作为服务器,并安装操作系统(操作系统安装参考第一篇文章https://www.jianshu.com/p/bf03f8c30557,也可以使用VMWare的克隆)。
再次来到Docker Hub https://hub.docker.com ,找到Nexus的镜像 Nexus3 https://hub.docker.com/r/sonatype/nexus3 ,把镜像拖进Docler。

docker pull sonatype/nexus3

在 /usr/local/docker/nexus 目录下写一个 docker-compose.yml 配置文件

version: '3.1'
services:
  nexus:
    restart: always
    image: sonatype/nexus3
    container_name: nexus
    ports:
      - 8081:8081
    volumes:
      - /usr/local/docker/nexus/data:/nexus-data

输入docker-compose up启动一下,然后出现了

Creating nexus ... done
Attaching to nexus
nexus    | mkdir: cannot create directory '../sonatype-work/nexus3/log': Permission denied
nexus    | mkdir: cannot create directory '../sonatype-work/nexus3/tmp': Permission denied
nexus    | OpenJDK 64-Bit Server VM warning: Cannot open file ../sonatype-work/nexus3/log/jvm.log due to No such file or directory
nexus    | 
nexus    | Warning:  Cannot open log file: ../sonatype-work/nexus3/log/jvm.log
nexus    | Warning:  Forcing option -XX:LogFile=/tmp/jvm.log
nexus    | Unable to update instance pid: Unable to create directory /nexus-data/instances
nexus    | /nexus-data/log/karaf.log (No such file or directory)
nexus    | Unable to update instance pid: Unable to create directory /nexus-data/instances

出现了 Permission denied 之类的权限问题,输入一条777命令chmod 777 /usr/local/docker/nexus/data
docker-compose up启动一下。后台就跑起来了,虽然还有各种警告

1.png

不用管他,在浏览器输入Docker宿主机的ip和Nexus的暴露端口 http://192.168.111.134:8081 发现Nexus已经可以打开了,登录账密默认为admin和admin123
2.png

现在,Nexus私服就算搭建完成了,如果需要继续操作控制台,可以 ctrl c 强退进程再 docker start id 重启容器。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容