无法在docker容器内运行jmeter命令

时间:2017-07-24 11:57:52

标签: jmeter dockerfile docker-for-windows docker-desktop

我正在尝试使用Dockerfile

在docker容器内运行以下命令
jmeter -n -t nature.jmx -l nature.jtl

我尝试使用RUN和CMD运行此命令

CMD ["jmeter", "-n"," -t nature.jmx -l nature1.jtl"]

RUN "jmeter -n -t nature.jmx -l nature.jtl"

RUN jmeter -n -t nature.jmx -l nature.jtl

但以上命令均无效。我一直收到以下错误:

  

C:\ Program Files \ Docker \ docker.exe:来自守护程序的错误响应:   容器02323b3d347904331938b0d27c639975899284b06a0e2f377350   833b55f1ef46在CreateProcess期间遇到错误:a中的失败   Windows系统调用:系统无法找到文件规范。 (0X2)   额外信息:{“ApplicationName”:“”,“CommandLine”:“jmeter -n -t   nature.jmx -l nature1.jtl“,”User“:”“,”WorkingDirec   托里 “:” C:\ JMeter的\ Apache的JMeter的-3.1 \ BIN “ ”环境“:{ ”JAVA_HOME“: ”C:\ ojdkbuild“, ”JAVA_OJDKBUILD_SHA256“:” 7e7384636054001   “JAVA_OJDKBUILD_VERSION”:“JAVA_OJDKBUILD_ZIP”:“java-1.8.0-ope njdk-1.8.0.131-1.b11.ojdkbuild.windows.x86_64.zip”,“JAVA_VERSION”: “8u131”,“JMETER_HOME”:“C:/jmeter/apache-jmeter-3.1”,“SET”:“P ATH = C:ProgramDataOracleJavajavapath; C:Windowssystem32; C:Windows; C:WindowsSystem32Wbem; C:WindowsSystem32WindowsPowerShellv1.0 ;C   :ojdkbuildbin; C:/jmeter/apache-jmeter-3.1bin; “},” EmulateConsole “:假” CreateStdInPipe “:真” CreateStdOutPipe “:真,” 创建   tdErrPipe“:true,”ConsoleSize“:[0,0]}。PS C:\ Users \ Administrator>

对此提出任何建议都会有所帮助。提前致谢。请找我的版本:

实验:假 PS C:\ Users \ Administrator> 尝试使用下面的Dockerfile构建映像

FROM microsoft/windowsservercore
    # $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324
    SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

ENV JAVA_HOME C:\\ojdkbuild
RUN $newPath = ('{0}\bin;{1}' -f $env:JAVA_HOME, $env:PATH); \
    Write-Host ('Updating PATH: {0}' -f $newPath); \
# Nano Server does not have "[Environment]::SetEnvironmentVariable()"
    setx /M PATH $newPath;

# https://github.com/ojdkbuild/ojdkbuild/releases
ENV JAVA_VERSION 8u131
ENV JAVA_OJDKBUILD_VERSION 1.8.0.131-1
ENV JAVA_OJDKBUILD_ZIP java-1.8.0-openjdk-1.8.0.131-1.b11.ojdkbuild.windows.x86_64.zip
ENV JAVA_OJDKBUILD_SHA256 7e7384636054001499ba96d55c90fc39cbb0441281254a1e9ac8510b527a7a46

RUN $url = ('https://github.com/ojdkbuild/ojdkbuild/releases/download/{0}/{1}' -f $env:JAVA_OJDKBUILD_VERSION, $env:JAVA_OJDKBUILD_ZIP); \
    Write-Host ('Downloading {0} ...' -f $url); \
    Invoke-WebRequest -Uri $url -OutFile 'ojdkbuild.zip'; \
    Write-Host ('Verifying sha256 ({0}) ...' -f $env:JAVA_OJDKBUILD_SHA256); \
    if ((Get-FileHash ojdkbuild.zip -Algorithm sha256).Hash -ne $env:JAVA_OJDKBUILD_SHA256) { \
        Write-Host 'FAILED!'; \
        exit 1; \
    }; \
    \
    Write-Host 'Expanding ...'; \
    Expand-Archive ojdkbuild.zip -DestinationPath C:\; \
    \
    Write-Host 'Renaming ...'; \
    Move-Item \
        -Path ('C:\{0}' -f ($env:JAVA_OJDKBUILD_ZIP -Replace '.zip$', '')) \
        -Destination $env:JAVA_HOME \
    ; \
    \
    Write-Host 'Verifying install ...'; \
    Write-Host '  java -version'; java -version; \
    Write-Host '  javac -version'; javac -version; \
    \
    Write-Host 'Removing ...'; \
    Remove-Item ojdkbuild.zip -Force; \
    \
    Write-Host 'Complete.';

#CMD ["java","-version"]


# Install jmeter
RUN   mkdir C:\jmeter

RUN cd /jmeter
RUN powershell.exe Invoke-WebRequest -usebasicparsing http://ftp.ps.pl/pub/apache/jmeter/binaries/apache-jmeter-3.1.zip -OutFile c:/apache-jmeter-3.1.zip
RUN powershell.exe Expand-Archive -Path C:\apache-jmeter-3.1.zip -DestinationPath C:/jmeter
#RUN mkdir C:/jmeter/apache-jmeter-2.13/apache-jmeter-3.1/jmeter-plugins
#RUN cd C:/jmeter/apache-jmeter-2.13/apache-jmeter-3.1/jmeter-plugins
#RUN Invoke-WebRequest -usebasicparsing  https://jmeter-#plugins.org/downloads/file/JMeterPlugins-ExtrasLibs-1.4.0.zip
#RUN Expand-Archive -Path C:/jmeter/apache-jmeter-2.13/apache-jmeter-#3.1/jmeter-plugins -DestinationPath  C:/jmeter/apache-jmeter-2.13/apache-#jmeter-3.1/jmeter-plugins

# Set Jmeter Home
ENV JMETER_HOME C:/jmeter/apache-jmeter-3.1

# Add Jmeter to the Path
ENV PATH $JMETER_HOME/bin:$PATH

COPY nature.jmx C:\\jmeter\\apache-jmeter-3.1\\bin\\nature.jmx

WORKDIR C:\\jmeter\\apache-jmeter-3.1\\bin

RUN jmeter -n -t nature.jmx -l nature.jtl

0 个答案:

没有答案