docker 部署jenkins 加速下载插件

 

yum install -y yum-utils
yum-config-manager \
  --add-repo \
  https://download.docker.com/linux/centos/docker-ce.repo
yum install -y docker-ce-19.03.9 docker-ce-cli-19.03.9 containerd.io docker-compose

mkdir -p /etc/docker/
mkdir -p /data/docker
cat >/etc/docker/daemon.json  <<EOF
{
  "data-root": "/data/docker",
  "log-driver":"json-file",
  "log-opts": {"max-size":"200m", "max-file":"10"}
}
EOF
systemctl enable docker && systemctl start docker
docker info | egrep "Docker Root Dir|Server Version"

useradd jenkins -s /sbin/nologin
mkdir -p /data/jenkins/
chown -R jenkins:jenkins /data/jenkins/
docker run -d \
   -p 8080:8080 \
   -p 50000:50000 \
   --name jenkins \
   -v /data/jenkins/:/var/jenkins_home \
   -e TZ="Asia/Shanghai" \
   jenkins/jenkins:latest

cat /data/jenkins/secrets/initialAdminPassword

cd jenkins_home/updates
sed -i 's/https:\/\/updates.jenkins.io\/download/https:\/\/mirrors.tuna.tsinghua.edu.cn\/jenkins/g' default.json
sed -i 's/http:\/\/www.google.com/https:\/\/www.baidu.com/g' default.json

 

重启jenkins

http://xxx.xxx.xxx/restart

 

posted @ 2021-07-24 11:25  缺个好听的昵称  阅读(7)  评论(0编辑  收藏  举报