[Docker]一键部署nexus

Dcoker-compose一键部署Nexus

创建配置文件

mkdir -p /opt/nexus/data
chown 200:200 -R /opt/nexus/data
cat > /opt/nexus/docker-compose.yml<<'EOF'
version: '3.7'
services:
  nexus:
    # 镜像名称
    image: 'sonatype/nexus3'
    # 容器名字 docker run --name
    container_name: nexus
    # 开机自动重启
    restart: always
    # 端口映射
    ports:
      - '8081:8081'
      - '80:8082'
    volumes:
      - /opt/nexus/data:/nexus-data
    environment:
      TZ: Asia/Shanghai
EOF
cd /opt/nexus/
docker-compose up -d

查看服务

[root@SaaS nexus]# docker ps -a
CONTAINER ID        IMAGE                    COMMAND                  CREATED             STATUS                 PORTS                                                            NAMES
400f24b1c02f        sonatype/nexus3          "sh -c ${SONATYPE_DI…"   48 minutes ago      Up 45 minutes          0.0.0.0:8081->8081/tcp                      

查询密码

# docker交互
cat /opt/nexus/data/admin.password    
209dc63c-7c9a-4def-92ae-ded41a3b5ec4

Docker 部署

mkdir -p /opt/nexus/data
chown 200:200 -R /opt/nexus/data
docker run -d -p 8081:8081 --restart=always --privileged=true --name nexus -v /opt/nexus/data:/nexus-data sonatype/nexus3
cat /opt/nexus/data/admin.password

END

posted @ 2020-04-21 16:31  LeoShi2020  阅读(353)  评论(0编辑  收藏  举报