CentOS 7中使用Docker安装jenkins

创建jenkins主目录:

mkdir -p /home/docker/jenkins/jenkins_home

设置权限:

chown -R 1000 /home/docker/jenkins

运行jenkins镜像:

docker run --name jenkins \
-p 58080:8080 \
-p 50000:50000 \
-v /home/docker/jenkins/jenkins_home:/var/jenkins_home \
jenkins/jenkins:lts-jdk11

开放防火墙端口:

firewall-cmd --permanent --add-port=58080/tcp
firewall-cmd --permanent --add-port=50000/tcp
firewall-cmd --reload

容器内的环境变量:

export COPY_REFERENCE_FILE_LOG='/var/jenkins_home/copy_reference_file.log'
export HOME='/var/jenkins_home'
export HOSTNAME='848bb135bba8'
export JAVA_DEBIAN_VERSION='11.0.3+1-1~bpo9+1'
export JAVA_HOME='/docker-java-home'
export JAVA_VERSION='11.0.3'
export JENKINS_ENABLE_FUTURE_JAVA='true'
export JENKINS_HOME='/var/jenkins_home'
export JENKINS_INCREMENTALS_REPO_MIRROR='https://repo.jenkins-ci.org/incrementals'
export JENKINS_SLAVE_AGENT_PORT='50000'
export JENKINS_UC='https://updates.jenkins.io'
export JENKINS_UC_EXPERIMENTAL='https://updates.jenkins.io/experimental'
export JENKINS_VERSION='2.164.2'
export LANG='C.UTF-8'
export PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
export PWD='/'
export TERM='xterm'

修改jenkins时区,以管理员身份进入容器:

docker exec -it -u root jenkins /bin/bash

修改timezone为东八区上海时间:

echo "Asia/Shanghai" > /etc/timezone

 

©️2020 CSDN 皮肤主题: 程序猿惹谁了 设计师:上身试试 返回首页