docker安装jenkins+maven-3.6.3+node-v14.18.3+java-1.8.0

安装maven-3.6.3

1)下载apache-maven-3.6.3-bin.tar.gz

wget apache-maven-3.6.3-bin.tar.gz

2)解压压缩包

tar -xf apache-maven-3.6.3-bin.tar.gz -C /usr/local/

3)配置环境变量

cat /etc/profile.d/maven.sh 
export MAVEN_HOME=/usr/local/apache-maven-3.6.3
export PATH=$PATH:$MAVEN_HOME/bin

安装node-v14.18.3-linux-x64.tar.gz

1)下载node-v14.18.3-linux-x64.tar.gz

wget node-v14.18.3-linux-x64.tar.gz

2)解压压缩包

tar -xf apache-maven-3.6.3-bin.tar.gz -C /data/opt

3)配置环境变量

cat /etc/profile.d/node.sh 
export NODE_HOME=/data/opt/node-v14.18.3
export NPM_HOME=/data/opt/node-v14.18.3
export PATH=$PATH:$NPM_HOME/bin:$NODE_HOME/bin

java-1.8.0-openjdk-amd64使用yum,或apt-get安装

使用docker-compose启动jenkins容器

1)创建docker-compose目录

mkdir /data/opt/docker-jenkins

2)创建docker-compose.yml 

cat docker-compose.yml 
version: '3'
services:
        jenkins:
                image: 'jenkins/jenkins'
                container_name: jenkins
                restart: always
                environment:
                        - TZ=Asia/Shanghai
                        - MAVEN_HOME=/usr/local/apache-maven-3.6.3
                        - NODE_HOME=/data/opt/node-v14.18.3
                        - JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64
                        - ANDROID_SDK_ROOT=/data/opt/android-sdk-linux/
                ports:
                        - '8888:8080'
                        - '50001:50000'
                volumes:
                        - '/etc/localtime:/etc/localtime'
                        - '/data/opt/docker-jenkins/profile:/etc/profile'
                        - '/etc/java-8-openjdk/:/etc/java-8-openjdk/'
                        - '/var/jenkins_home:/var/jenkins_home'
                        - '/var/run/docker.sock:/var/run/docker.sock'
                        - '/usr/bin/docker:/usr/bin/docker'
                        - '/usr/lib/jvm/java-1.8.0-openjdk-amd64:/usr/lib/jvm/java-1.8.0-openjdk-amd64'
                        - '/usr/local/apache-maven-3.6.3:/usr/local/apache-maven-3.6.3'
                        - '/data/opt/node-v14.18.3:/data/opt/node-v14.18.3'
                        - '/data/opt/android-sdk-linux/:/data/opt/android-sdk-linux/'
                        - '/etc/ssl/certs/java/cacerts:/etc/ssl/certs/java/cacerts'

3)通过docker-compose启动jenkins

# 通过docker-compose.yml启动
docker-compose up -d
# 查看是否启动成功
docker-compose ps 
 Name                Command               State                                           Ports                                         
-----------------------------------------------------------------------------------------------------------------------------------------
jenkins   /sbin/tini -- /usr/local/b ...   Up      0.0.0.0:50001->50000/tcp,:::50001->50000/tcp, 0.0.0.0:8888->8080/tcp,:::8888->8080/tcp
posted @ 2022-10-19 10:02  yxy_linux  阅读(404)  评论(0编辑  收藏  举报