Jenkins-slave integrated mirror and docker kubectl

1. Description

jenkins / jnlp-slave mirroring integrated docker and kubectl command of the official.

 

2, Dockerfile file

The bottom mirror is used Debian system, to change the download source, and then install the docker-ce, and download the files kubectl (by network download link official walled, so that the download link provided with rancher).

FROM jenkins/jnlp-slave
ENV KUBECTL_VERSION=v1.14.5
USER root
RUN echo "deb http://mirrors.163.com/debian/ stretch main" > /etc/apt/sources.list && \
    echo "deb http://mirrors.163.com/debian/ stretch-updates main non-free contrib" >> /etc/apt/sources.list && \
    echo "deb http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib" >> /etc/apt/sources.list
RUN apt-get update && \
    apt-get -y install apt-transport-https ca-certificates curl software-properties-common && \
    curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/debian/gpg | apt-key add - && \
    add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/debian $(lsb_release -cs) stable" && \
    apt-get -y update && \
    apt-get -y install docker-ce
RUN curl -L https://www.cnrancher.com/download/kubernetes/linux-amd64-${KUBECTL_VERSION}-kubectl -o /usr/local/bin/kubectl \
    && chmod +x /usr/local/bin/kubectl

Construction of Mirror

docker build -t jenkins-jnlp-slave-docker-kubectl .

 

 

Reference: https://hub.docker.com/r/nipsuli/docker-jnlp-slave-kubectl/dockerfile

 

Guess you like

Origin www.cnblogs.com/weavepub/p/11388270.html
Recommended