Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reg : Unable to build docker image #17

Closed
SindhujaSoundarapandian opened this issue Mar 25, 2019 · 3 comments
Closed

Reg : Unable to build docker image #17

SindhujaSoundarapandian opened this issue Mar 25, 2019 · 3 comments

Comments

@SindhujaSoundarapandian

Hi,

I am trying to build the docker image through the steps mentioned in your portal, But i am getting connection refused error in docker build command

I have used git bash to run the commands

1.git clone https://github.com/justb4/docker-jmeter.git
cd docker-jmeter
2. ./build.sh - but it throws some error so i have given the below command
$ docker build --build-arg JMETER_VERSION=5.1.1 -t "justb4/jmeter" .
i got an error in build command stating like run command returned non-zero

"The command '/bin/sh -c curl -L --silent ${JMETER_DOWNLOAD_URL} > /tmp/dependencies/apache-jmeter-${JMETER_VERSION}.tgz' returned a non-zero code: 7
"

I have tried editing the below lines and reran the command
RUN apk update
&& apk upgrade
&& apk add ca-certificates
&& update-ca-certificates
&& apk add --update openjdk8-jre tzdata curl unzip bash
&& rm -rf /var/cache/apk/*
&& mkdir -p /tmp/dependencies
&& curl -L --silent ${JMETER_DOWNLOAD_URL} > /tmp/dependencies/apache-jmeter-${JMETER_VERSION}.tgz
&& mkdir -p /opt
&& tar -xzf /tmp/dependencies/apache-jmeter-${JMETER_VERSION}.tgz -C /opt
&& rm -rf /tmp/dependencies

where i could see the connection refused error

Step 17/26 : RUN wget https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-5.1.1.tgz
---> Running in ec3d762ec007
Connecting to archive.apache.org (163.172.17.199:443)
wget: can't connect to remote host (163.172.17.199): Connection refused
The command '/bin/sh -c wget https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-5.1.1.tgz' returned a non-zero code: 1

But if i tried to open the same url in browser it starts downloading.

I have tried in many possibilities but still no luck from my end. Can anyone help me here

This is my docker file

inspired by https://github.com/hauptmedia/docker-jmeter and

https://github.com/hhcordero/docker-jmeter-server/blob/master/Dockerfile

FROM alpine:3.9

MAINTAINER Just van den Broeckejust@justobjects.nl

ARG JMETER_VERSION="5.1.1"
ENV JMETER_HOME /opt/apache-jmeter-${JMETER_VERSION}
ENV JMETER_BIN ${JMETER_HOME}/bin
ENV JMETER_DOWNLOAD_URL https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-${JMETER_VERSION}.tgz

Install extra packages

See gliderlabs/docker-alpine#136 (comment)

Change TimeZone TODO: TZ still is not set!

ARG TZ="Europe/Amsterdam"
RUN apk update
RUN apk upgrade
RUN apk add ca-certificates
RUN update-ca-certificates
RUN apk add --update openjdk8-jre tzdata curl unzip bash
RUN apk add --no-cache nss
RUN rm -rf /var/cache/apk/*
RUN mkdir -p /tmp/dependencies
RUN curl -L --silent ${JMETER_DOWNLOAD_URL} > /tmp/dependencies/apache-jmeter-${JMETER_VERSION}.tgz
RUN mkdir -p /opt
RUN tar -xzf /tmp/dependencies/apache-jmeter-${JMETER_VERSION}.tgz -C /opt
RUN rm -rf /tmp/dependencies

TODO: plugins (later)

&& unzip -oq "/tmp/dependencies/JMeterPlugins-*.zip" -d $JMETER_HOME

Set global PATH such that "jmeter" command is found

ENV PATH $PATH:$JMETER_BIN

Entrypoint has same signature as "jmeter" command

COPY entrypoint.sh /

WORKDIR ${JMETER_HOME}

ENTRYPOINT ["/entrypoint.sh"]

Thanks,
Sindhuja

@justb4
Copy link
Owner

justb4 commented Mar 25, 2019

@SindhujaSoundarapandian Could it be you are behind a (http(s)) proxy?
Problem (and solution) looks similar here: moby/moby#24697

@SindhujaSoundarapandian
Copy link
Author

SindhujaSoundarapandian commented Mar 29, 2019

@justb4 : Yeah you are right , when we got full access to the system it was working fine
but when we tried to execute ./test.sh we are getting the below error
$ ./test.sh
./run.sh: line 11: sudo: command not found
==== jmeter.log ====
cat: tests/trivial/jmeter.log: No such file or directory
==== Raw Test Report ====
cat: tests/trivial/test-plan.jtl: No such file or directory
==== HTML Test Report ====
See HTML test report in tests/trivial/report/index.html

Also when i tried to open the run.sh file i could see the below lines
**sudo docker stop ${NAME} > /dev/null 2>&1
sudo docker rm ${NAME} > /dev/null 2>&1
sudo docker run --name ${NAME} -i -v ${PWD}:${PWD} -w ${PWD} ${IMAGE} $@

I have removed the sudo in test.sh and tried running the same command

$ ./test.sh
<C:\Program Files\Docker\Docker\Resources\bin\docker.exe>: Error response from daemon: Mount denied:
The source path "E:/docker-jmeter;E"
doesn't exist and is not known to Docker.
See '<C:\Program Files\Docker\Docker\Resources\bin\docker.exe> run --help'.
==== jmeter.log ====
cat: tests/trivial/jmeter.log: No such file or directory
==== Raw Test Report ====
cat: tests/trivial/test-plan.jtl: No such file or directory
==== HTML Test Report ====
See HTML test report in tests/trivial/report/index.html**

Also What is meant by the PWD mentioned in run.sh ? is it relating to path to working directory ? if so were we could see the installed jmeter location in windows since we are using linux containers and we couldn't get a chance to view the opt folder. What is the syntax to run jmx files through docker container , please help us to resolve this.

Thanks in Advance !
Sindhuja

@justb4
Copy link
Owner

justb4 commented Mar 29, 2019

The ${PWD} is to mount the current dir into the JMeter Container such that JMeter can find its testplans specified in the args ($@). On Windows this can be problematic as directories may not be able to be mounted. The test.sh is just an example, you should find out what the best strategy is for your local situation.

@justb4 justb4 closed this as completed Mar 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants