Jenkins官方Docker镜像在原有的基础上添加了一些基础东西。
一. sources.list文件, 更换国内源
deb http://mirrors.163.com/debian/ stretch main non-free contrib deb http://mirrors.163.com/debian/ stretch-updates main non-free contrib deb http://mirrors.163.com/debian/ stretch-backports main non-free contrib deb-src http://mirrors.163.com/debian/ stretch main non-free contrib deb-src http://mirrors.163.com/debian/ stretch-updates main non-free contrib deb-src http://mirrors.163.com/debian/ stretch-backports main non-free contrib deb http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib deb-src http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib
二. Dockerfile文件
FROM jenkins/jenkins:2.190.3 USER root RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone ADD sources.list /etc/apt/sources.list RUN apt-get update -y ADD get-docker.sh /get-docker.sh RUN wget https://yum.dockerproject.org/gpg && apt-key add gpg RUN curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/debian/gpg | apt-key add - RUN curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - && apt-key fingerprint 0EBFCD88 RUN apt-get install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common vim RUN add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" && sed -i 's/download.docker.com/mirrors.ustc.edu.cn/docker-ce/g' /etc/apt/sources.list RUN apt-get update -y RUN echo " StrictHostKeyChecking no" >> /etc/ssh/ssh_config && /get-docker.sh