Jenkins-slave 鏡像集成 docker 和 kubectl


1、說明

對官方的 jenkins/jnlp-slave 鏡像集成 docker 和 kubectl 命令。

 

2、Dockerfile 文件

該鏡像底層采用的是 Debian 系統,先更改下載源,然后安裝 docker-ce,並下載 kubectl 文件(因官網下載鏈接有牆,故用 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

構建鏡像

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

 

 

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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM