liveBook · Manning

Entrypoint instruction

As explained in Kubernetes in Action, Second Edition

The ENTRYPOINT instruction specifies the executable command that runs when a container starts.

The ENTRYPOINT instruction defines the executable command that runs when a container starts. In a Dockerfile, it commonly names the application and its executable arguments, while CMD supplies default runtime arguments. section 8.1

Starting a Node.js application

A minimal Dockerfile can use ENTRYPOINT ["node", "app.js"]. With CMD ["--listen-port", "8080"], the container starts the Node.js application with port 8080 as its default argument. section 8.1

ENTRYPOINT is part of the container image’s startup configuration. Docker records it as a Dockerfile layer, alongside layers created by COPY and other directives. section 2.2.2

The image values act as defaults when no options are supplied. Kubernetes can override command and argument defaults in a pod manifest. section 8.1

Listing 8.1 A sample Dockerfile using several application configuration methods
FROM node:12
COPY app.js /app.js
COPY html/ /html

ENV INITIAL_STATUS_MESSAGE="This is the default status message"      #1

ENTRYPOINT ["node", "app.js"]            #2
CMD ["--listen-port", "8080"]      #3

Inspect a complete Dockerfile showing ENTRYPOINT alongside ENV and CMD. section 8.1

How Kubernetes in Action, Second Edition covers it

How deep it goes
Explains executable selection, CMD arguments, image layers, and Kubernetes overrides without detailing pod manifest syntax.
Examples
Uses Node.js Dockerfiles, the Kiada application, docker build output, and docker history output.
What it assumes
Assumes basic familiarity with container images and Dockerfiles while introducing command, argument, and environment configuration.
What you can do after
Apply it via a Dockerfile to make a container launch a chosen application with default command-line arguments.
How it connects
Connects ENTRYPOINT with Dockerfile, CMD, ENV, COPY, container images, and Kubernetes pod manifests.

Also explained in

Compare how 3 books explain entrypoint instruction →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kubernetes in Action, Second Edition. The section links point to the parts of the book it draws on.