码迷,mamicode.com
首页 > 其他好文 > 详细

docker Jenkins

时间:2020-06-30 12:41:21      阅读:52      评论:0      收藏:0      [点我收藏+]

标签:ali   切换   install   raw   upd   security   uname   lbs   pts   

Jenkins

docker市场

docker pull jenkins/jenkins:lts
docker inspect ba607c18aeb7 查看版本
mkdir /home/jenkins_home

docker run —network=dg —restart=always -p 8080:8080 -p 50000:50000 -d -v /home/jenkins_home:/var/jenkins_home —name myjenkins jenkins/jenkins:lts

自定义docker

vim Dockerfile

FROM jenkins/jenkins:lts

USER root
#清除了基础镜像设置的源,切换成腾讯云的jessie源
#使用非腾讯云环境的需要将 tencentyun 改为 aliyun
RUN echo ‘‘ > /etc/apt/sources.list.d/jessie-backports.list   && echo "deb http://mirrors.aliyun.com/debian jessie main contrib non-free" > /etc/apt/sources.list   && echo "deb http://mirrors.aliyun.com/debian jessie-updates main contrib non-free" >> /etc/apt/sources.list   && echo "deb http://mirrors.aliyun.com/debian-security jessie/updates main contrib non-free" >> /etc/apt/sources.list
#更新源并安装缺少的包
RUN apt-get update && apt-get install -y libltdl7 && apt-get update

ARG dockerGid=999

RUN echo "docker:x:${dockerGid}:jenkins" >> /etc/group 

# 安装 docker-compose 因为等下构建环境的需要
RUN curl -L https://github.com/docker/compose/releases/download/1.16.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose

RUN chmod +x /usr/local/bin/docker-compose

mkdir -p /var/jenkins_home
chown -R 1000 /var/jenkins_home
构建image

docker build . -t myjenkins

启动

docker run --name myjenkins --network=dg --restart=always -e JAVA_OPTS=-Duser.timezone=Asia/Shanghai -p 8080:8080 -p 50000:50000     -v /var/run/docker.sock:/var/run/docker.sock     -v $(which docker):/bin/docker     -v /var/jenkins_home:/var/jenkins_home     -d myjenkins

https://updates.jenkins.io/update-center.json 升级地址改成下面的
http://mirror.xmission.com/jenkins/updates/current/update-center.json

 
 

docker Jenkins

标签:ali   切换   install   raw   upd   security   uname   lbs   pts   

原文地址:https://www.cnblogs.com/huangyoum/p/13212828.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!