Skip to content

Insights

Container Security Beyond Image Scanning: Runtime Configuration Across Orchestration Platforms

Published · Updated

Your container images might pass every security scan while your runtime configuration leaves the door open. Here's what image scanning misses and how to secure containerized workloads.

Picture a fintech team that is proud of its container security posture. Their dashboards show 100% of images scanned, zero critical CVEs in production, base images updated within 72 hours of upstream patches, and image signing at every step. By any image-scanning metric, they are doing everything right.

Now picture an attacker getting into their production Kubernetes cluster. The entry point is a pod running in privileged mode with the Docker socket mounted as a volume. From there the attacker escapes the container, gains root on the node and moves laterally across the cluster. The review afterwards finds two dozen other pods with similar settings; any of them could have been the entry point.

The images were secure. Every one passed the scanning pipeline. But the runtime configuration (the manifests and task definitions that actually deployed those images) was not. That is the gap image scanning doesn't address, and it keeps catching organizations off guard.

The orchestration landscape: this applies to everyone

Everything in this article applies whether you run:

Kubernetes ecosystem

  • Vanilla Kubernetes
  • Red Hat OpenShift
  • Amazon EKS
  • Google GKE
  • Azure AKS
  • Rancher / k3s

Other platforms

  • Docker Compose
  • Docker Swarm
  • AWS ECS / Fargate
  • HashiCorp Nomad
  • Podman

Each platform has its own terminology. Kubernetes has Pods with SecurityContexts. ECS has Tasks with containerDefinitions. Docker Compose has service definitions with security_opt. They share the same basic challenge: the configuration that deploys the container decides its security posture, not the image.

The examples below rotate between platforms. Don't skip a section because it uses a different orchestrator than yours; the principles carry over.

What image scanning covers (and does well)

Image scanning is valuable and necessary. A good pipeline catches:

  • Known CVEs: vulnerabilities in packages, libraries and base images that have published CVE identifiers.
  • Outdated dependencies: old library versions that should be updated, even without a specific CVE.
  • Embedded secrets: API keys, passwords and certificates accidentally baked into image layers.
  • Image provenance: signatures, and whether the image came from a trusted source.
  • License compliance: packages with problematic licenses.

This is your supply-chain security. Keep doing it. But image scanning tells you what's in the container. It tells you nothing about how the container will run.

Think of it this way: image scanning is inspecting a car before it leaves the factory. Runtime configuration is how the car is driven. The safest car in the world doesn't help if someone drives it at 150 mph with the doors open.

The runtime configuration gap

Image scanning can't detect the following, because none of it is defined in the image. It's defined in the deployment configuration.

Privileged mode and excessive capabilities

Privileged containers effectively have root on the host. They can load kernel modules, access all devices and escape container isolation easily.

Platform syntax

  • Kubernetes: securityContext.privileged: true
  • Kubernetes: capabilities.add: ["SYS_ADMIN"]
  • Docker: --privileged
  • Compose: privileged: true
  • ECS: "privileged": true
  • OpenShift: permissive SCC assignment

Impact

  • Container escapes become easy
  • Full host takeover is possible
  • Access to all host devices
  • Kernel module loading
  • Container isolation is bypassed

A common pattern: a large share of workloads in a cluster run privileged because a developer hit "permission denied" and adding privileges was the fastest fix. Nobody went back to find the one capability that was actually needed, because the deadline came first.

Host filesystem mounts

Mounting host paths into containers bypasses isolation. The most dangerous mounts give a container direct access to critical host resources.

Kubernetes hostPath:

path: /var/run/docker.sock
path: /
path: /etc

Docker / Compose:

-v /:/host:rw
-v /var/run/docker.sock:/var/run/docker.sock

Mounting /var/run/docker.sock gives the container full Docker API access. It can create containers, inspect any container and control the Docker daemon. That is equivalent to root on the host. It still shows up in production often, usually because a CI/CD container needed to run Docker commands.

Missing or permissive network policies

The default network policy in most orchestrators is "allow everything". Every container can talk to every other container, and usually to the internet.

Platform implementations

  • Kubernetes: NetworkPolicy objects (opt-in)
  • OpenShift: SDN network isolation
  • ECS: security group configuration
  • Swarm: overlay network isolation
  • Compose: network definitions

Common problems

  • No NetworkPolicies defined at all
  • The default "allow all" never restricted
  • Database pods reachable from the internet
  • No egress restrictions

A typical finding: database pods that can reach the public internet. They should only talk to the application pods, but nobody defined network policies and the default was allow-all. The database could send data to any IP address.

Missing resource limits

Containers without resource limits can consume all available CPU and memory, starving other workloads on the same host.

  • Kubernetes: missing resources.limits in the container spec
  • OpenShift: LimitRanges not enforced at namespace level
  • ECS: task definition without memory and cpu hard limits
  • Compose: no deploy.resources.limits

Overprivileged service accounts and IAM roles

Containers inherit permissions from their service accounts (Kubernetes) or IAM roles (AWS). Overprivileged accounts give attackers paths for lateral movement.

A common example: every pod shares one service account that was given cluster-admin because "it was easier". One compromised container can then read every secret in the cluster: database passwords, API keys, TLS certificates.

On ECS, the equivalent is a task role with s3:* on * because the application needed to read from one bucket, and a wildcard was faster than working out the specific permissions.

Running as root and missing security contexts

By default, many containers run as root (UID 0). If an attacker escapes the container, they are root on the host. Running as non-root limits the blast radius.

Platform defaults

  • Kubernetes: runAsNonRoot isn't set by default; containers run as whatever USER the Dockerfile specifies (often root).
  • OpenShift: the Restricted SCC enforces non-root, but many teams use custom, more permissive SCCs.
  • Docker: runs as root unless the image sets USER or you pass --user.
  • ECS: no enforcement; depends on the task definition and image.

Why this happens

Developer experience vs. security

The secure path is usually the harder one. When a container won't start because of a permission error, --privileged fixes it instantly. Finding the specific capability that's needed takes research and testing. Under deadline pressure, the quick fix wins.

Copy-paste from tutorials

Forum answers and blog tutorials often include privileged: true or Docker socket mounts because they work everywhere. They get copied into production without anyone knowing why the flags were there. The tutorial author needed them for a reason that doesn't apply to your use case.

Lack of understanding

Many developers don't know what CAP_SYS_ADMIN grants, or why mounting /var/run/docker.sock is dangerous. They are experts in their own domain; container security isn't it. Defaults should protect them, and often don't.

Platform differences

What works in development (Docker Compose on a laptop) needs different configuration in production (Kubernetes in a cloud). Security contexts in Kubernetes have no direct equivalent in Compose, and teams often don't translate security controls when they move between platforms.

Missing guardrails

If the platform allows privileged: true, people will use it. Most platforms allow everything by default and expect you to add restrictions. Often those restrictions never get added.

Organizational silos

Developers deploy containers. The security team audits weeks or months later. By then the insecure settings are in production, applications depend on them, and fixing them is a project rather than a quick change.

Every container starts compliant

Every container image starts compliant. Your CI/CD pipeline builds a secure image, it passes all scans, and it is tagged, signed and pushed to a trusted registry.

Then someone writes a deployment manifest, a task definition or a docker-compose.yml, and adds:

  • privileged: true because the pod wouldn't start otherwise
  • a hostPath mount because they needed to debug something
  • no runAsNonRoot, because that's the default and nobody changed it
  • a service account with cluster-admin because RBAC was confusing
  • no resource limits, because nobody was sure what values to set

The drift doesn't happen at build time. It happens at deployment time. The running container can be insecure even though the image is clean. Your image scanning pipeline can't catch this; it's not in the image, it's in the manifest.

Admission controllers and policy engines

The preventive answer is admission control: policies that reject insecure configurations before they're deployed. It has limits worth understanding.

Kubernetes admission control

  • PodSecurityPolicy: deprecated in 1.21, removed in 1.25. If you still rely on it, plan the migration.
  • Pod Security Standards: the replacement. Three levels: Privileged, Baseline, Restricted. Better than nothing, but coarse-grained.
  • OPA/Gatekeeper: a custom policy engine that can enforce almost anything. It takes real investment to configure well.
  • Kyverno: an alternative with Kubernetes-native syntax. Lower learning curve, similar capabilities.

OpenShift Security Context Constraints

OpenShift's SCCs are more opinionated than vanilla Kubernetes. The Restricted SCC prevents privileged containers, root users and host access by default. But teams often create custom SCCs that are more permissive because "the application needs it". The control exists; it just isn't always used as intended.

ECS / Fargate

There's no admission-control equivalent. Task definitions are validated for syntax, not for security. You rely on IAM permissions to stop insecure task definitions, and most ECS security controls sit at the AWS account level rather than the task level.

Docker Swarm / Compose

Minimal built-in policy enforcement. Security depends almost entirely on configuration discipline. Nothing says "this compose file is insecure, reject it".

The basic limitation: all of these tools enforce what you tell them to enforce, not security by default. If you haven't defined a policy against privileged containers, they'll be admitted. If you haven't restricted host mounts, they're allowed. Guardrails only exist if someone builds them.

Continuous runtime checks

Admission control is prevention. On its own it isn't enough:

  • Policies can be misconfigured or have gaps
  • Exceptions get granted "temporarily" and never revoked
  • Configuration can drift after deployment
  • Someone with cluster-admin can bypass policies
  • Workloads deployed before the policies existed aren't affected

You need to check what is actually running, not only what admission policy says should be running.

What to check continuously

  • Containers running in privileged mode
  • Excessive Linux capabilities
  • Host filesystem mounts, especially sensitive paths
  • Containers running as root (UID 0)
  • Missing resource limits
  • Overly permissive network policies
  • Service accounts with excessive RBAC permissions
  • IAM roles with overly broad policies

Platform-specific detection methods

  • Kubernetes: query the API for pod specs, inspect securityContext fields, check mounted volumes.
  • OpenShift: compare active SCCs with pod configurations; look for custom permissive SCCs.
  • ECS: inspect running task definitions through the AWS API; check privileged, user and linuxParameters.
  • Docker: docker inspect shows the actual container configuration, including security options.
  • Swarm: docker service inspect for deployed service configurations.

The remediation challenge

Finding misconfigurations is step one. Fixing them at scale is harder. You can't kill a running production container and hope for the best.

Remediation usually means:

  • Updating the source manifest, Helm chart or task definition
  • Testing the secure configuration in staging
  • Working with the application team, who may not know why their configuration is risky
  • Handling stateful workloads carefully
  • Rolling out changes progressively

A realistic remediation workflow

When you find a privileged container, don't just kill it. What works:

  1. Alert the owning team with specifics: what's misconfigured and why it's risky.
  2. Give a reasonable timeline (for example 30 days for non-critical, faster for high-risk).
  3. Point to the secure alternative (one usually exists).
  4. Offer to help test the fix outside production.
  5. Turn on audit mode first: log violations, don't block.
  6. Once the fix is confirmed, turn on enforcement.

The aim isn't to catch people out. It's to make systems more secure without breaking production.

Platform-specific examples

Before/after configurations for common patterns.

Kubernetes / OpenShift

Insecure:

apiVersion: v1
kind: Pod
metadata:
  name: app
spec:
  containers:
  - name: app
    image: myapp:latest
    securityContext:
      privileged: true
    volumeMounts:
    - name: host-root
      mountPath: /host
    - name: docker-sock
      mountPath: /var/run/docker.sock
  volumes:
  - name: host-root
    hostPath:
      path: /
  - name: docker-sock
    hostPath:
      path: /var/run/docker.sock

Secure:

apiVersion: v1
kind: Pod
metadata:
  name: app
spec:
  securityContext:
    runAsNonRoot: true
    runAsUser: 1000
    fsGroup: 2000
    seccompProfile:
      type: RuntimeDefault
  containers:
  - name: app
    image: myapp:latest
    securityContext:
      allowPrivilegeEscalation: false
      readOnlyRootFilesystem: true
      capabilities:
        drop: ["ALL"]
    resources:
      limits:
        memory: "512Mi"
        cpu: "500m"
    volumeMounts:
    - name: app-data
      mountPath: /data
  volumes:
  - name: app-data
    emptyDir: {}

Docker Compose

Insecure:

services:
  app:
    image: myapp:latest
    privileged: true
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /:/host
    network_mode: host

Secure:

services:
  app:
    image: myapp:latest
    user: "1000:1000"
    security_opt:
      - no-new-privileges:true
    cap_drop:
      - ALL
    read_only: true
    tmpfs:
      - /tmp
    volumes:
      - app-data:/data
    deploy:
      resources:
        limits:
          cpus: '0.5'
          memory: 512M
    networks:
      - app-network

volumes:
  app-data:

networks:
  app-network:
    driver: bridge

AWS ECS task definition

Insecure:

{
  "containerDefinitions": [{
    "name": "app",
    "image": "myapp:latest",
    "privileged": true,
    "user": "root",
    "linuxParameters": {
      "capabilities": {
        "add": ["SYS_ADMIN", "NET_ADMIN"]
      }
    }
  }]
}

Secure:

{
  "containerDefinitions": [{
    "name": "app",
    "image": "myapp:latest",
    "privileged": false,
    "user": "1000",
    "readonlyRootFilesystem": true,
    "linuxParameters": {
      "capabilities": {
        "drop": ["ALL"]
      },
      "initProcessEnabled": true
    },
    "memory": 512,
    "cpu": 256
  }]
}

Where LEA fits

LEA Platform checks host configuration on Linux, macOS and Windows; it does not read Kubernetes, OpenShift or ECS manifests. On Linux hosts, including container hosts, the agent runs read-only commands and sends the raw output to the server, which decides pass or fail. The shipped rule library includes a "Docker Socket Not Mounted" check, and you can write your own rules for host-level settings such as Docker daemon configuration files. Orchestrator-level policy (admission control, pod security, task definitions) still needs the platform's own tools.

Two sides of the same coin

Image scanning secures your container supply chain. Runtime configuration checks secure your running infrastructure. You need both; they cover different attack surfaces.

Every orchestration platform, whether Kubernetes, OpenShift, EKS, ECS, Swarm or anything else, shares the same challenge: containers can be deployed with settings that bypass the security you built into the image. A hardened image running privileged with the Docker socket mounted is not a secure workload.

Better image scanning won't fix that. Continuous checking of runtime security settings will catch misconfigurations before they become incidents.

Key takeaways

  • Image scanning is necessary but not sufficient. Secure images can run in insecure configurations. Supply-chain security isn't runtime security.
  • This applies to every platform. Kubernetes, OpenShift, ECS, Docker Compose, Swarm: the terminology differs, the runtime challenges are the same.
  • Drift happens at deployment. Every container starts compliant. Misconfigurations come from manifests and task definitions, not images.
  • Admission control needs configuration. Policy engines only enforce what you tell them to.
  • Keep checking what runs. Policies have gaps, exceptions accumulate and configurations drift.

Try LEA Platform on your own servers:

Start a free POC

Try it on your own servers.

30 days, up to 25 endpoints, every feature. We help you install it and agree on success criteria first.