我无法构建jmeter docker文件,出现以下错误。
WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/v3.9/main/x86_64/APKINDEX.tar.gz: temporary error (try again later)
WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/v3.9/community/x86_64/APKINDEX.tar.gz: temporary error (try again later)
ERROR: unsatisfiable constraints:
curl (missing):
required by: world[curl]
fontconfig (missing):
required by: world[fontconfig]
net-tools (missing):
required by: world[net-tools]
shadow (missing):
required by: world[shadow]
su-exec (missing):
required by: world[su-exec]
tcpdump (missing):
required by: world[tcpdump]
ttf-dejavu (missing):
required by: world[ttf-dejavu]
The command '/bin/sh -c chmod +x /usr/local/bin/entrypoint.sh && apk add --no-cache curl fontconfig net-tools shadow su-exec tcpdump ttf-dejavu && cd /tmp/ && curl --location --silent --show-error --output apache-jmeter-${JMETER_VERSION}.tgz ${MIRROR}/apache-jmeter-${JMETER_VERSION}.tgz && curl --location --silent --show-error --output apache-jmeter-${JMETER_VERSION}.tgz.sha512 ${MIRROR}/apache-jmeter-${JMETER_VERSION}.tgz.sha512 && sha512sum -c apache-jmeter-${JMETER_VERSION}.tgz.sha512 && mkdir -p /opt/ && tar x -z -f apache-jmeter-${JMETER_VERSION}.tgz -C /opt && rm -R -f apache* && sed -i '/RUN_IN_DOCKER/s/^# //g' ${JMETER_BIN}/jmeter && sed -i '/PrintGCDetails/s/^# /: "${/g' ${JMETER_BIN}/jmeter && sed -i '/PrintGCDetails/s/$/}"/g' ${JMETER_BIN}/jmeter && chmod +x ${JMETER_HOME}/bin/*.sh && jmeter --version && curl --location --silent --show-error --output /opt/alpn-boot-${ALPN_VERSION}.jar http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/${ALPN_VERSION}/alpn-boot-${ALPN_VERSION}.jar && rm -fr /tmp/*' returned a non-zero code: 7
Dockerfile:
FROM openjdk:8u201-jdk-alpine3.9
LABEL maintainer="emmanuel.gaillardon@orange.fr"
STOPSIGNAL SIGKILL
ENV MIRROR https://www-eu.apache.org/dist/jmeter/binaries
ENV JMETER_VERSION 5.1.1
ENV JMETER_HOME /opt/apache-jmeter-${JMETER_VERSION}
ENV JMETER_BIN ${JMETER_HOME}/bin
ENV ALPN_VERSION 8.1.13.v20181017
ENV PATH ${JMETER_BIN}:$PATH
COPY entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/entrypoint.sh
&& apk add --no-cache
curl
fontconfig
net-tools
shadow
su-exec
tcpdump
ttf-dejavu
&& cd /tmp/
&& curl --location --silent --show-error --output apache-jmeter-${JMETER_VERSION}.tgz ${MIRROR}/apache-jmeter-${JMETER_VERSION}.tgz
&& curl --location --silent --show-error --output apache-jmeter-${JMETER_VERSION}.tgz.sha512 ${MIRROR}/apache-jmeter-${JMETER_VERSION}.tgz.sha512
&& sha512sum -c apache-jmeter-${JMETER_VERSION}.tgz.sha512
&& mkdir -p /opt/
&& tar x -z -f apache-jmeter-${JMETER_VERSION}.tgz -C /opt
&& rm -R -f apache*
&& sed -i '/RUN_IN_DOCKER/s/^# //g' ${JMETER_BIN}/jmeter
&& sed -i '/PrintGCDetails/s/^# /: "${/g' ${JMETER_BIN}/jmeter && sed -i '/PrintGCDetails/s/$/}"/g' ${JMETER_BIN}/jmeter
&& chmod +x ${JMETER_HOME}/bin/*.sh
&& jmeter --version
&& curl --location --silent --show-error --output /opt/alpn-boot-${ALPN_VERSION}.jar http://central.maven.org/maven2/org/mortbay/jetty/alpn/alpn-boot/${ALPN_VERSION}/alpn-boot-${ALPN_VERSION}.jar
&& rm -fr /tmp/*
# Required for HTTP2 plugins
ENV JVM_ARGS -Xbootclasspath/p:/opt/alpn-boot-${ALPN_VERSION}.jar
WORKDIR /jmeter
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["jmeter", "--?"]
如果缺少什么,任何人都可以告诉我吗
该错误表明Alpine apk软件包管理工具无法安装curl
,fontconfig
和其他软件包,因为无法 http://dl-cdn.alpinelinux.org/alpine/v3.9/main/x86_64/连接到主机并从那里获取文件。
确保您的主机具有互联网,如果它确实遵循了 My docker 容器中的建议,则没有互联网答案。
另请注意,目前JMeter 5.2已经发布,所以我建议至少更改此行:
ENV MIRROR https://www-eu.apache.org/dist/jmeter/binaries
对此:
ENV MIRROR https://archive.apache.org/dist/jmeter/binaries
否则,即使您解决了互联网连接问题,您的 Dockerfile 也无法正常工作。
或者,您可以提高JMETER_VERSION
以匹配最新的稳定JMeter版本
基于阿尔卑斯山的JDK图像,反过来,你是基于的,实际上,非常基本的(没有双关语!(,它被剥夺了除了非常核心之外的几乎所有东西。
因此,它只是不包含您尝试在那里使用的实用程序 - 它会立即向您报告丢失。
不过,从好的方面来说 - 它真的很小,5MB左右。
您可以做的是两件事:
1(在使用软件包之前通过Alpine软件包管理器apk
安装软件包(类似于apk add curl
,请通过apk search
自己找出确切的软件包名称(。 这是阿尔卑斯山处理此类案件的"官方"方式。
2(基于一些更通用的Linux映像。不过,在我的记忆中,它会变得更大,几十兆字节。