liveBook · Manning

Entrypoint file

As explained in Road to Kubernetes

An entrypoint script is an executable script that performs startup logic and launches an application inside a container.

An entrypoint script is an executable startup script that launches an application inside a container. Docker runs it at container runtime through CMD, not during image construction. Using a script instead of placing the application command directly in CMD leaves room for startup logic, such as checking database availability or adapting configuration. section 5.3.4

A containerized entrypoint script typically:

  • Reads runtime configuration from environment variables, such as PORT, and supplies a fallback when no value exists. section 5.3.4
  • Runs the application using the executable and arguments appropriate to its runtime. section 5.3.4 section 5.4.1

Python and Node.js entrypoints

A Python entrypoint sets RUNTIME_PORT to PORT or 8080, then runs Gunicorn with UvicornWorker, main:app, and a bind address using that port. A Node.js entrypoint can simply run node /app/src/main.js when the application already reads PORT itself. section 5.4.1

Do not confuse an entrypoint script with Docker's ENTRYPOINT directive. CMD can invoke the script while keeping the container configuration straightforward; the script itself remains the place for application-specific startup behavior. section 5.3.4

How Road to Kubernetes covers it

How deep it goes
Explains script responsibilities and Dockerfile integration with runnable commands, while stopping short of detailed process-management internals.
Examples
Uses Python Gunicorn and Node.js main.js scripts, alongside Dockerfile COPY, chmod, CMD, and .dockerignore artifacts.
What it assumes
Assumes familiarity with Dockerfiles and application start commands while demonstrating runtime configuration and executable permissions.
What you can do after
Build it from scratch by writing, parameterizing, copying, permissioning, and invoking an application startup script in Docker.
How it connects
Connects entrypoint scripts to Dockerfiles, CMD, environment variables, Gunicorn, Uvicorn, and Node.js.

Related concepts

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