Skip to content

Docker: Use image as a binary with ENTRYPOINT and CMD #110

@ja-albert

Description

@ja-albert

Splitting the CMD in the Dockerfile into an ENTRYPOINT and CMD would give an more intuitive CLI. For example, this Dockerfile:

ENTRYPOINT ["/mws/bin/mwsd"]
CMD ["-p", "8080", "-I", "/data"]

would allow to directly interact with the mwsd binary:

  • docker run mathwebsearch to run mwsd on port 8080 with the harvest in /data (like at the moment)
  • docker run mathwebsearch --help to run mwsd --help
  • docker run mathwebsearch -p 8888 -I /myData to run mwsd on port 8888 with the harvest in /myData

(Not sure if the CMD part should also be moved to the ENTRYPOINT as defaults - probably depends on the implementation. That is, how does it handle two -p and -I options?)

For a more detailed explanation, see https://stackoverflow.com/questions/21553353/what-is-the-difference-between-cmd-and-entrypoint-in-a-dockerfile

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions