docker Jenkins
Posted huangyoum
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了docker Jenkins相关的知识,希望对你有一定的参考价值。
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的主要内容,如果未能解决你的问题,请参考以下文章