docker-compose安装nexus3

愿君学长松,慎勿作桃李。这篇文章主要讲述docker-compose安装nexus3相关的知识,希望能为你提供帮助。
安装前的准备准备
如果本机是首次使用docker-compose环境部署,需要在在/deploy/sorts创建以下脚本并执行
vi pre_install.sh

vi pre_install.sh #!/bin/bash ###关闭selinux sed -i \'s/SELINUX=enforcing/SELINUX=disabled/g\' /etc/selinux/config setenforce 0 yum install -y yum-utils device-mapper-persistent-data lvm2 yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo yum makecache fast yum -y install docker-ce ###配置拉取国内镜像仓库 tee /etc/docker/daemon.json < < -\'EOF\' { "registry-mirrors": [ "https://5sr5uink.mirror.aliyuncs.com", "https://docker.mirrors.ustc.edu.cn", "https://hub-mirror.c.163.com", "https://mirror.baidubce.com" ], "insecure-registries": ["harbor.xxx.com"] } EOF ###启动docker systemctl start docker systemctl enable docker ### 下载docker-compose curl -L "https://get.daocloud.io/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/bin/docker-compose chmod +x /usr/bin/docker-compose docker-compose -version

【docker-compose安装nexus3】sh pre_install.sh
创建nexus目录及相关子目录
mkdir /deploy/sorts/nexus3 cd /deploy/sorts/nexus3 mkdir data

创建yml编排文件
vi docker-compose.yml version: \'3.7\' services: nexus: image: harbor.xxx.com/xxx/nexus3 restart: always container_name: nexus3 ports: - "8081:8081" volumes: - ./data:/nexus-data environment: - TZ=Asia/Shanghai

创建启动和停止脚本
vi up.sh #!/bin/bashset -etm=`date +%Y%m%d-%H%M%S` echo "=====================================================" echo "Starting nexus3." echo "Starting < ${tm}> ." echo "=====================================================" echo "Please ensure the config files right." echo "====================================================="docker-compose-p nexus3 up -d

vi down.sh #!/bin/bashset -etm=`date +%Y%m%d-%H%M%S` echo "=====================================================" echo "Stopping nexus3." echo "Stopping < ${tm}> ." echo "=====================================================" echo "Please ensure the config files right." echo "====================================================="docker-compose -p nexus3 down

启动
sh ups.sh [root@localhost-203-root-all nexus3]# docker-compose ps NameCommandStatePorts ------------------------------------------------------------------------------------------ nexus3sh -c ${SONATYPE_DIR}/star ...Up0.0.0.0:8081-> 8081/tcp,:::8081-> 8081/tcp

配置阿里云缓存仓库
浏览器访问nexus所在节点IP+8081
设置--Repository--Create Repository----Maven2(proxy)
在Remote Storage里面填上阿里云私库地址http://maven.aliyun.com/nexus/content/groups/public/
docker-compose安装nexus3

文章图片


    推荐阅读