Question - Can you tell the difference between CMD and ENTRYPOINT?
Answer -
CMD command provides executable defaults for an executing container. In case the executable has to be omitted then the usage of ENTRYPOINT instruction along with the JSON array format has to be incorporated.
ENTRYPOINT specifies that the instruction within it will always be run when the container starts.
This command provides an option to configure the parameters and the executables. If the DockerFile does not have this command, then it would still get inherited from the base image mentioned in the FROM instruction.
- The most commonly used ENTRYPOINT is /bin/sh or /bin/bash for most of the base images.
As part of good practices, every DockerFile should have at least one of these two commands.