When you provide an ENTRYPOINTand a CMD in an image, the command line for starting a container is the concatenation of the two, in the order ENTRYPOINTCMD. Going by your Dockerfile, the default command line is artillery --help.
In the docker run command, whatever you type after the image name replaces the CMD, not the ENTRYPOINT. So for example, if you execute docker run aio abc def, the command line will be artillery abc def.
After reading your README file, I think the easiest way to solve your problem would be to change the CMD line in your Dockerfile as follows:
Glad it worked. But I am stuck with a different issues. I am getting a very different output. To explain this:
If you could clone my project and build an image with Dockerfile along with your changes and run container like below - My test just runs with no scenarios.
docker container run aio
But, If I start the container with below command it works fine. If you could build an image and run, you will be able to see how output of the container is different.
docker container run aio run ./services/employeeServices/scenarios/create-employee-details.yml --config ./services/employeeServices/config.yml --overrides "$(cat ./services/employeeServices/overrides.slos.json)" -e local
Any inputs from you will really help me. I believe its not taking files correctly.
My Dockerfile:
FROM node:10.17.0-alpine
LABEL maintainer="Pranay Gupta"
WORKDIR /artillery
RUN chmod 777 /artillery
COPY . .
RUN apk update && apk upgrade && apk add bash
RUN chmod +x ./entrypoint.sh
RUN npm install -g artillery artillery-plugin-expect --unsafe-perm=true --alow-root
RUN npm i --unsafe-perm=true --alow-root
ENTRYPOINT ["artillery"]
CMD [ "run","./services/employeeServices/scenarios/create-employee-details.yml","--config","./services/employeeServices/config.yml","--overrides","\"$(cat ./services/employeeServices/overrides.slos.json)\"","-e", "local"]
On second thought, your entrypoint.sh seemed like a better idea. So I cloned your repo, changed the Dockerfile, built the image and ran the container. It seems to work.
Here’s the Dockerfile:
FROM node:10.17.0-alpine
LABEL maintainer="Pranay Gupta"
WORKDIR /artillery
RUN chmod 777 /artillery
COPY . .
RUN apk update && apk upgrade && apk add bash
RUN chmod +x ./entrypoint.sh
RUN npm install -g artillery artillery-plugin-expect --unsafe-perm=true --alow-root
RUN npm i --unsafe-perm=true --alow-root
ENTRYPOINT ["./entrypoint.sh"]
I apologize for troubling you again. I would like your insight again. I opened another issuer earlier regarding calling declared value in entrypoint.sh file where you clarified my doubt.
The issue is for the same artillery test for which you helped me answer the current answer in this post. I have updated my github project. With your above help, standalone artillery image is working.
Could you guide me to make it work with docker-compose.yml file? The args are not passing in entrypoint.sh file.