ENTRYPOINT
The Dockerfile instruction that sets the program a container always runs, with CMD supplying its default arguments.
In more detail
Arguments given to docker run replace only the CMD part, while the --entrypoint option overrides the program itself. A fixed entrypoint means users can run the image without remembering a special command. Write it in exec form, a list such as ["python", "app.py"], so signals reach the program.
Examples
ENTRYPOINT ["/app/app.sh"]ENTRYPOINT ["python", "app.py"]
CMD ["--port", "8000"]ENTRYPOINT ["/app"]ENTRYPOINT ["java","-jar","app.jar"]Related terms
- Dockerfile — A text file of instructions, such as FROM, COPY and RUN, that tells Docker how to build an image.
- CMD — The Dockerfile instruction that sets the default command a container runs when you do not give one.
- exec form — Writing RUN, CMD or ENTRYPOINT as a JSON list such as ["python", "app.py"], so the program runs directly without a shell.
- graceful shutdown — Stopping a service in an orderly way: finish current work, close connections, then exit.
Taught in
- Building and Pushing Container Images — Continuous Integration & Continuous Delivery Pipelines
- Container Images The Exam Way — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Minimal Base Images: Less To Attack — Certified Kubernetes Security Specialist (CKS) Exam Prep
- Container Hardening: Distroless & Rootless — Cloud Security & DevSecOps Engineering
- CMD, ENTRYPOINT, USER And Process Signals — Docker Architecture & Production Containers
- Shipping in Scratch and Distroless Images — Concurrent Systems Programming with Go
- Packaging Into A Container — Modern Java: Virtual Threads & High-Throughput Services
- Twelve Lines, Ten Warnings: Dockerfile Instructions And hadolint — Docker Certified Associate (DCA) Exam Prep
- Images Sprint: Eight Questions On Builds, Tags And Registries — Docker Certified Associate (DCA) Exam Prep
- Security Sprint: Eight Questions On Defaults, Trust And Access — Docker Certified Associate (DCA) Exam Prep
- Works On My Laptop: Images, Containers, Volumes And Networks — CompTIA Linux+ (XK0-006) Exam Prep