Skip to content

Commit

Permalink
Using ENTRYPOINT to simplify docker run semantics
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mtlynch committed Mar 15, 2020
1 parent 8e3e969 commit c119663
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 ["./"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit c119663

Please sign in to comment.