Shared host PID namespace

Remove unnecessary host PID sharing and preserve process isolation.

Description

pid: "host" lets a container see processes outside its own workload by sharing the host’s process ID (PID) namespace.

Potential impact

The container can see information about host processes. Its user and capabilities determine which processes it can signal or otherwise control.

Remediation

Remove pid: "host" from the application service. If a diagnostic tool needs host process visibility, keep that exception in a separate debugging configuration and review its user, capabilities and mounts.

Examples

Replace sample/app:latest with your application image.

Before

yaml
services:
  service_name_1:
    image: sample/app:latest
    pid: "host"

After

yaml
services:
  service_name_1:
    image: sample/app:latest

References