目录
操作系统版本:CentOS 7.4 64位
-
准备nexus本地目录
mkdir /usr/nexus
cd /usr/nexus
mkdir nexus-data
chmod 777 nexus-data
-
准备nexus.yml文件
version: "3"
services:
nexus:
container_name: nexus
image: ${REPO:-docker.io}/sonatype/nexus3
ports:
- "8081:8081"
restart: always
volumes:
- "/usr/nexus/nexus-data:/nexus-data"
这里使用的8081端口
-
使用nexus.yml构建Docker容器
docker-compose -f nexus.yml up -d
-
其他命令
#进入容器
docker exec -i -t nexus /bin/bash
#查看容器日志
docker logs nexus -f
-
重启容器
cd /usr/nexus/
#关闭容器
docker-compose -f nexus.yml down
#重启容器
docker-compose -f nexus.yml up -d