docker部署Nexus

2022-10-27 15:13:47 浏览数 (2)

部署nexus

  • docker部署nexus
代码语言:javascript复制
docker pull sonatype/nexus3
mkdir /data/nexus-data
chown -R 200 /data/nexus-data
docker run -d --name nexus3 --restart=always -p 8081:8081 -p 8082:8082 -v /data/nexus-data:/nexus-data sonatype/nexus3
  • docker-compose部署nexus
代码语言:javascript复制
version: "3"

services:
  nexus:
    image: sonatype/nexus3:latest
    container_name: nexus
    hostname: nexus
    restart: always
    ports:
      - 8081:8081
      - 8082:8082
    volumes:
      - /data/nexus-data:/nexus-data

创建docker仓库

代码语言:javascript复制
设置 --> Repositories --> Create repository --> docker(hosted) 
Name:输入创建的名字,如docker-repo
HTTP:8082
启动Enable Docker V1 API

连接仓库

代码语言:javascript复制
vim /etc/docker/daemon.json

{
    "registry-mirrors": ["https://hk0l6i5k.mirror.aliyuncs.com"],
    "insecure-registries": ["192.168.1.76:8082"]
}

登录仓库

代码语言:javascript复制
docker login -u admin -p 123456 192.168.1.76:8082

0 人点赞