Deploy Docker Nexus3

Compose 部署 Nexus3

1)创建程序目录并授权

$ mkdir -p /opt/cicd/nexus3/nexus-data
$ chmod 777 !$

2)创建 yml 文件

$ cat > nexus3.yml << EOF
version: '3'
services:
  nexus:
    image: sonatype/nexus3:3.50.0
    restart: always
    container_name: nexus3
    environment:
      - TZ=Asia/Shanghai
      - INSTALL4J_ADD_VM_PARAMS=-Xms128m -Xmx1024m -XX:MaxDirectMemorySize=512m
    ports:
      - '8081:8081'
    volumes:
      - ./nexus-data:/nexus-data
EOF

3)启动服务并使用浏览器登录

1
2
3
$ docker-compose -f nexus3.yml up -d
$ docker exec -it nexus3 cat /nexus-data/admin.password
950486d2-6d02-429e-86e4-3967fccf65da