docker-compose安装nexus3
Posted 草根追逐
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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
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/bash
set -e
tm=`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/bash
set -e
tm=`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
Name Command State Ports
------------------------------------------------------------------------------------------
nexus3 sh -c ${SONATYPE_DIR}/star ... Up 0.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的主要内容,如果未能解决你的问题,请参考以下文章
EdgeX: 使用最新的 edgex2.0 在 ubuntu 上进行部署,替换私服地址nexus3.edgexfoundry.org 成 docker官方地址,解决下载问题。有了新UI界面