通过自定义podTemplate升级maven和jdk,同时按照文档修改了Jenkins配置文件,也登录Jenkins重新加载了
- maven构建问题解决了
- 但是docker打包镜像时提示无docker这个命令
- docker build -f Dockerfile -t 192.168.3.142:8082/library/finai-demo-devops-api:SNAPSHOT-master-9 .
/home/jenkins/agent/workspace/ch_finai-demo-devops-cicd_master@tmp/durable-6b21eb3a/script.sh: 1: /home/jenkins/agent/workspace/ch_finai-demo-devops-cicd_master@tmp/durable-6b21eb3a/script.sh: docker: not found
script returned exit code 127
这种问题一般要怎么排查
打包的dockerfile如下
FROM kubesphere/builder-base:v2.1.0
MAINTAINER xxx
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US:en
ENV LC_ALL=en_US.UTF-8
RUN yum remove -y java-1.8.0-openjdk \
&& mkdir /usr/local/java \
&& mkdir /opt/ant
WORKDIR /home/jenkins
ADD jdk-11.0.8_linux-x64_bin.tar.gz /usr/local/java
ENV JAVA_HOME /usr/local/java/jdk-11.0.8
ENV PATH $JAVA_HOME/bin:$PATH
ADD apache-maven-3.6.1-bin.tar.gz /opt
ENV MAVEN_VERSION=3.6.1
ENV M2_HOME=/opt/apache-maven-3.6.1
ENV maven.home=/opt/apache-maven-3.6.1
ENV M2=/opt/apache-maven-3.6.1/bin
ENV PATH $M2:$PATH
ADD apache-ant-1.10.9-bin.tar.gz /opt/ant
ENV ANT_VERSION=1.10.9
ENV ANT_HOME=/opt/ant
ENV PATH $ANT_HOME/bin:$PATH
CMD mvn -version