部署jenkins(使用华为云war包,手动制作jenkins镜像)
环境准备
1、JDK镜像准备
docker pull openjdk:8-jdk-oracle
2、jenkins的war包准备
https://mirrors.huaweicloud.com/jenkins/war/
我下载的2.291版本,也可以下载最新的版本
制作jenkins镜像
1、编写Dockerfile
FROM openjdk:8-jdk-oracle
ENV JAVA_HOME /java
ENV PATH $PATH:$JAVA_HOME/bin
ENV CLASSPATH .:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
RUN apk update
RUN apk add --no-cache make gcc libc-dev bash tree tzdata \
&& cp -r -f /usr/share/zoneinfo/Hongkong /etc/localtime
WORKDIR /jenkins
COPY jenkins.war ./
ENTRYPOINT ["java","-Dhudson.model.DownloadService.noSignatureCheck=true","-jar","jenkins.war","--httpPort=8080"]
2、制作镜像(将war包和Dockerfile放在同一个文件夹下)
进入Dockerfile文件目录,执行:docker build -t jenkins:2.291 .