From c119663583f5d5859806e1f3d4b45a7c6544d9d0 Mon Sep 17 00:00:00 2001 From: Michael Lynch Date: Sat, 14 Mar 2020 20:35:35 -0400 Subject: [PATCH] Using ENTRYPOINT to simplify docker run semantics This change specifies htmltest as the ENTRYPOINT command in the Dockerfile. This change makes it so that Docker concatenates the ENTRYPOINT and the CMD. The big benefit is that clients don't have to redundantly type the binary name when they run the Docker image. Instead of this: docker run -v /home/mike/htmltest:/test --rm wjdp/htmltest htmltest -l 3 -s they can leave out the second 'htmltest' like this: docker run -v /home/mike/htmltest:/test --rm wjdp/htmltest -l 3 -s --- Dockerfile | 3 ++- README.md | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5396825..eb9a0f8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,4 +20,5 @@ RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/* WORKDIR /bin COPY --from=builder /app ./htmltest WORKDIR /test -CMD [ "htmltest", "./"] +ENTRYPOINT ["htmltest"] +CMD ["./"] diff --git a/README.md b/README.md index 05a46d7..b3dd423 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ You can also build from sources by cloning this repo and running `sh build.sh`, Mount your directory with html files into the container and test them. If you need more arguments to the test run it like this: -```docker run -v $(pwd):/test --rm wjdp/htmltest htmltest -l 3 -s``` +```docker run -v $(pwd):/test --rm wjdp/htmltest -l 3 -s``` ### Notes