ComplyIT
Container Security Checklist
A practical list for security and compliance teams. Tick an item when you can show the evidence. General information, not legal or professional advice.
Image and build
The container image security checklist: what has to be true before an image is allowed to ship.
Pin the base image. Build from a specific version or a digest. Do not ship production images from latest or any other floating tag.
Run as a non-root user. Set USER in the image. Do not leave root as the default and hope the cluster remembers to drop it.
Use a multi-stage build. Compilers, package managers, and test tools stay in the build stage. They do not belong in the image you run.
Keep secrets out of the build. Do not pass credentials as build arguments or copy a .env file into a layer. Image history keeps both.
Scan in CI and block on unaccepted criticals. Fail the push when a critical vulnerability has no recorded exception. A report nobody acts on is not a gate.
Publish an SBOM with the digest. Produce SPDX or CycloneDX for the image you ship, and store it with that digest in the registry or the build record.
Registry
Where the image lives, who can change it, and how you know the copy you pulled is the copy you built.
Deploy from a registry you control. Production pulls come from your private registry. They do not pull straight from a public registry at deploy time.
Require authentication to push and to pull. Grant push only to the CI identity that builds that image. Require authentication for pulls from your registry.
Sign images and verify the signature. Cosign or Notation is enough. Admission has to reject an image whose signature does not check. A signature you never verify is not a control.
Scan again after the build. New vulnerabilities show up in old images. Scan the registry on a schedule, not only the day the image was built.
Track the digest that is running. A mutable tag is not an inventory. Record the digest deployed to each environment.
Runtime
A clean image can still be a dangerous process. These are the limits on what that process is allowed to do.
Start with a read-only root filesystem. Mount an explicit writable volume only where the process must write, such as /tmp.
Drop Linux capabilities. Drop all capabilities and add back only what the process needs. Do not leave NET_RAW or SYS_ADMIN in place by default.
Apply a seccomp profile. RuntimeDefault is the floor. A custom profile is better when you know the syscalls the process actually uses.
Forbid privileged containers and host namespaces. No privileged pods, and no host PID, host network, or host IPC, unless a named exception is still in date.
Forbid dangerous mounts. Block hostPath mounts of the host root, /etc, and the container runtime socket. A mounted socket is a breakout.
Set CPU and memory limits. Every workload has requests and limits so one container cannot exhaust the node.
Watch what the process does. Alert on a shell, a package install, or an outbound connection the image should never make.
Orchestration and Kubernetes
The cluster is a second control plane. Pod Security Standards replaced PodSecurityPolicy, which Kubernetes removed in 1.25.
Protect the API server. Do not leave it open to anonymous access. Prefer a private endpoint, and use short-lived credentials for people.
Keep RBAC narrow. Workload service accounts are not cluster-admin. Human access is separate from the identity a pod uses.
Do not mount the default service account token. Set automountServiceAccountToken to false unless that pod calls the Kubernetes API.
Enforce Pod Security Standards. Restricted for application namespaces. Baseline only where Restricted cannot run. Anything looser needs an exception.
Reject bad pods at admission. Block privileged pods, host namespaces, untrusted registries, and unsigned images in the API server, not in next week's report.
Separate namespaces. Split by environment and by sensitivity. A shared default namespace is not a boundary.
Encrypt Secrets at rest and limit who can read them. Confirm encryption at rest is on for your cluster, and treat get on Secrets as a privileged action.
Patch the nodes. Containers share the node kernel. A kernel or runtime fix, including a container-escape bug in runc, is a node patch, not an image rescan.
Secrets
Credentials are not image layers, and they are not environment files committed next to the Dockerfile.
Keep secrets out of images, Dockerfiles, and Git. Search history as well as the current tree. A secret in an old commit or an old layer is still a secret.
Inject secrets at runtime. Use Kubernetes Secrets with encryption at rest, or an external secret manager. The image stays free of credentials.
Prefer workload identity. Use the cloud's workload identity for the pod instead of a long-lived access key mounted into the filesystem.
Scope each secret to one workload. Do not mount one shared bundle of every key into every pod. Rotate credentials, and revoke them when a pipeline or a person leaves.
Treat a leaked build log as a compromise. Scan source and CI logs for tokens. If a secret was printed, rotate it. Do not mark the finding as informational.
Network
Kubernetes does not default-deny. A pod with no NetworkPolicy can reach whatever the network already allows.
Use a policy the cluster actually enforces. NetworkPolicy for ingress and egress, or an equivalent control your CNI applies. A policy your plugin ignores is documentation.
Default-deny the namespace. Select the pods and allow nothing until you add rules. Isolation starts when a policy selects the pod, not when you meant to write one.
Allow only the peers and ports you need. Name ingress sources and egress destinations. Wide-open egress is how a foothold becomes a callback.
Keep admin paths off the application network. The API server, registry administration, and node access do not sit on the same flat network as ordinary pods.
Test the policy with a fresh pod. A new pod with no explicit allow should fail to reach anything sensitive. If it can, you do not have default-deny.
Logging and monitoring
You need a record the workload cannot edit, tied to the digest that ran, not only the tag you remember.
Ship stdout and stderr off the node. Send container logs to a store the workload cannot delete or rewrite.
Audit sensitive API calls. Log who created a privileged pod, who read a Secret, and who changed RBAC. Keep those audit logs outside the cluster's admin path.
Alert on the breaks that matter. Privileged pods, host mounts, unsigned images, and an interactive shell in production should page someone.
Log the digest. The event should say which image digest ran. A tag can move out from under the investigation.
Keep logs long enough, and lock down delete. Retention has to cover an investigation. The people who run the workloads should not be able to wipe the record.
Policy and governance
The list above is a control only where a policy names it, an owner owns it, and a pipeline or the API server enforces it.
Publish a container security policy with a named owner. The checks you enforce should be the checks the policy requires. See what that document needs to contain below.
Encode the blocking rules. Non-root, no privileged, signed images, approved registries, and default-deny network belong in CI or admission, not only in a PDF.
Record exceptions with an expiry. Each exception has a reason, an owner, a compensating control, and a date it ends. An expired exception reverts to the rule.
Review the policy on a schedule. At least once a year, when the platform changes, and after any container-related incident.
Give security a view of what is deployed. If only the platform team can see the cluster, you cannot assure it. Read access to workloads, images, and exceptions is part of the control.
What a container security policy should include
- Scope: clusters, environments, pipelines, and third-party images that are in, and what is out.
- Owners: who owns base images, who runs the cluster, who approves an exception.
- Image rules: approved bases, non-root, the vulnerability threshold, an SBOM, and a signature.
- Registry rules: which registries are allowed, who can push, and the ban on production pulls from a public registry.
- Runtime and cluster rules: privileged pods, host mounts, Pod Security Standards, RBAC, network default-deny, and resource limits.
- Secrets: nothing in images or Git, how secrets are issued and rotated, and workload identity instead of static keys.
- Detection: what is logged, what pages someone, and how long the record is kept.
- Exceptions and enforcement: which rules block a build or an admission, which are detect-only, and how an exception expires.
complyit.pro/blog/container-security-moving-beyond-the-checklist