docker部署nexus3私服

mkdir /home/data/nexus-data

chmod 777 nexus-data

docker run --restart="always" -d -p 8899:8081 --name nexus -v /home/data/nexus-data:/nexus-data sonatype/nexus3

访问:http://localhost:8899

登录:用户名:admin  密码:第一次密码要用 /home/data/nexus-data/admin.password中的密码,登录之后系统会提示修改密码

mkdir /home/repo2

chmod -R 777 /home/repo2

vi mavenimport2.sh

************** 内容 start **************

#!/bin/bash

# copy and run this script to the root of the repository directory containing files

# this script attempts to exclude uploading itself explicitly so the script name is important

# Get command line params

while getopts ":r:u:p:" opt; do

    case $opt in

        r) REPO_URL="$OPTARG"

        ;;

        u) USERNAME="$OPTARG"

        ;;

        p) PASSWORD="$OPTARG"

        ;;

    esac

done

find . -type f -not -path './mavenimport\.sh*' -not -path '*/\.*' -not -path '*/\^archetype\-catalog\.xml*' -not -path '*/\^maven\-metadata\-local*\.xml' -not -path '*/\^maven\-metadata\-deployment*\.xml' | sed "s|^\./||" | xargs -I '{}' curl -u "$USERNAME:$PASSWORD" -X PUT -v -T {} ${REPO_URL}/{} ;

************** 内容 end **************

cd /home/repo2

将本地的manven仓库压缩,如果本地压缩文件大于4G建议采用7z进行压缩,然后传到服务器到进行解压

7za a spring_cloud_resposiory.7z spring_cloud_resposiory/

7za x spring_cloud_resposiory.7z

mv mavenimport2.sh /home/repo2/spring_cloud_resposiory/

将mavenimport2.sh文件放入spring_cloud_resposiory文件中

./mavenimport2.sh  -u admin -p admin123 -r http://192.168.0.129:8899/repository/znyg/

你可能感兴趣的:(docker部署nexus3私服)