dockerfile里面的内容编写顺序,必须严格按照顺序编写,否则编译不成
完整文档请参照https://www.cnblogs.com/effortsing/p/10480972.html 这里只介绍dockerfile里面的步骤顺序 cat>/home/jenkins-dockerfile/Dockerfile <<EOF FROM jenkinsci/jenkins USER root RUN apt-get update && apt-get install -y libltdl7.* RUN apt-get install vim* -y ADD apache-maven-3.5.4-bin.tar.gz /usr/local/ ENV MAVEN_HOME=/usr/local/apache-maven-3.5.4 ENV PATH=$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH ARG dockerGid=999 RUN echo "docker:x:${dockerGid}:jenkins" >> /etc/group RUN echo "jenkins ALL=NOPASSWD: ALL" >> /etc/sudoers EOF 上面Dockerfile中必须先执行apt-get update && apt-get install -y libltdl7.*,再安装maven,添加环境变量,否则编译会报如下错误: debconf: delaying package configuration, since apt-utils is not installed dpkg: warning: 'ldconfig' not found in PATH or not executable dpkg: warning: 'start-stop-daemon' not found in PATH or not executable E: Sub-process /usr/bin/dpkg returned an error code (2) The command '/bin/sh -c apt-get update && apt-get install -y libltdl7.*' returned a non-zero code: 100