/plushcap/analysis/spacelift/spacelift-docker-entrypoint-vs-cmd

Docker ENTRYPOINT and CMD : Differences & Examples

What's this blog post about?

Docker's CMD and ENTRYPOINT instructions work together to define the command that runs when a container starts. ENTRYPOINT sets the process that will be executed inside the container, while CMD supplies default arguments to that process. Images can only have one ENTRYPOINT, which defaults to /bin/sh -c if not specified. The docker run command starts a new container using a specified image and sets the CMD passed as arguments to the image's ENTRYPOINT. It is possible to override the ENTRYPOINT using the --entrypoint flag, but this should rarely be necessary for container images being used in the intended way. Separating these two instructions makes Docker container images more flexible, particularly when packaging command-line applications.

Company
Spacelift

Date published
Aug. 28, 2023

Author(s)
James Walker

Word count
1489

Hacker News points
None found.

Language
English


By Matt Makai. 2021-2024.