IT lexicon › Infra & Ops › Init container

Init container

Infra & Ops På svenska → Updated: 2026-05-27

A Kubernetes container that runs to completion before the main container starts. Use: wait for dependencies (DB ready), DB schema migration, fetch secrets/config, set filesystem permissions.

Multiple init containers run sequentially. If one fails, the whole pod restarts per restartPolicy. Completely separate from the main image — can be a tiny Alpine + bash script while main is a 1 GB Java app. Since Kubernetes 1.29, there are native sidecar containers (init container with restartPolicy=Always) that replace many init patterns. Pre-sidecar: a log shipper as init container was a hack — it died on main restart.

← Back to the lexicon