Day-2 Assigment-2

5 Differences between CMD and ENTRYPOINT with example

CMD Entrypoint

  1. the executable command will be replaced by the command 1. The executable command can’t be changed
    given while running the container
  2. We can’t pass the arguments for the CMD command 2. The commands passed while running the container will be appended to the RUN command
  3. Multiple times can be added in the dockerfile 3. same as CMD
    but the last line will override the previous
  4. Choose CMD if you need to provide a default command 4. Prefer ENTRYPOINT to CMD when building executable Docker image
    and/or arguments that can be overwritten from command line and you need a command always to be execute
    when docker container runs
  5. Treated as additional param when it is used 5. Always the main command
    along with ENTRYPOINT