Docker - Override or remove ENTRYPOINT from a base image

user2253130 picture user2253130 · Dec 18, 2016 · Viewed 10.2k times · Source

I'm using Docker (version 1.12.2, build bb80604) to setup a simple image/container with Gatling (Load Testing tool) + NodeJS. So, I pulled this Docker/Gatling base image and created my own Dockerfile to install NodeJS on it.

However, the Docker/Gatling base image above has an ENTRYPOINT already defined to call Gatling straightaway and then automatically exits the container. It looks like this:

ENTRYPOINT ["gatling.sh"]

What I'm trying to achieve is: I want to run a second command (my own NodeJS script to parse the test results), however I couldn't find a solution so far (I tried overriding the ENTRYPOINT, different combinations of ENTRYPOINT and CMD, but no success).

Here is how my current Dockerfile looks like:

FROM denvazh/gatling:2.2.3

RUN apk update \
&& apk add -U bash \
&& apk add nodejs=6.7.0-r0

COPY simulations /opt/gatling/user-files/simulations
COPY trigger-test-and-parser.sh /opt/gatling/

RUN chmod +x /opt/gatling/trigger-test-and-parser.sh

ENTRYPOINT ["bash", "/opt/gatling/trigger-test-and-parser.sh"]

Here is the command I'm using to build my image based on my Dockerfile:

docker build --no-cache -t gatling-nodejs:v8 .

And this is the command I'm using to run my container:

docker run -i -v "$PWD/results":/opt/gatling/results -v "$PWD":/opt/gatling/git.campmon.com/rodrigot/platform-hps-perf-test gatling-nodejs:v8

And this is the shellscript (trigger-test-and-parser.sh) I'd like to execute once the container starts (it should trigger Gatling and then runs my NodeJS parser):

gatling.sh -s MicroserviceHPSPubSubRatePerfTest.scala
node publish-rate-to-team-city.js

Any ideas or tweaks so I can run both commands once my container starts?

Thanks a lot!

Answer

Graham Dumpleton picture Graham Dumpleton · Dec 18, 2016

Set ENTRYPOINT to /usr/bin/env. Then set CMD to be what you want run.