# Ensure that the PIDs cgroup limit is used

- Source: https://support.icompaas.com/support/solutions/articles/62000234357-ensure-that-the-pids-cgroup-limit-is-used
- Section: [Solutions](https://support.icompaas.com/support/solutions) › [CIS Docker Benchmark v1.7.0](https://support.icompaas.com/support/solutions/62000112687) › [CIS Docker Benchmark](https://support.icompaas.com/support/solutions/folders/62000169241)
- Last updated: 2026-05-29
- Publisher: iCompaas, Inc. (https://www.icompaas.com)

Profile Applicability:

-   Level 1 
    

Description:

The PIDs cgroup limit ensures that the number of processes in a container is controlled. Without this limit, containers could spawn an excessive number of processes, potentially leading to resource exhaustion or denial-of-service attacks.

**Rationale:**

Limiting the number of processes that a container can spawn prevents containers from overwhelming the system with too many processes. It helps maintain the stability and reliability of both the container and the host system.

**Impact:**

Pros:

-   Reduces the risk of a container consuming all available system resources by spawning too many processes.
    
-   Helps in managing system resources more effectively.
    

Cons:

-   Setting a very low PID limit could potentially affect containers that require more processes to run properly.
    

**Default Value:**

By default, Docker does not set a specific limit on the number of processes a container can spawn.  

**Pre-requisites:**

-   Docker must be installed and configured on the system.
    
-   Administrative privileges to configure container limits.
    

**Remediation:**

**Test Plan:**

**Using AWS Console:**

1.  Navigate to the EC2 instance running Docker.
    
2.  Ensure the Docker command includes the \--pids-limit option.
    
3.  You can check the PID limit using the following:
    

docker inspect <container\_id> | grep "PidsLimit"

**Using AWS CLI:**

1.  Connect to the EC2 instance where Docker is running.
    
2.  Run the following command to inspect the container's PID limit:
    

docker inspect <container\_id> | grep "PidsLimit"

**I****mp****lementation Plan:**

**Using AWS Console:**

1.  Connect to the EC2 instance.
    
2.  When running or creating a container, use the \--pids-limit option to set a maximum number of processes:     
    
      docker run --pids-limit 100 my\_container\_image
    
3.  Alternatively, update an existing container configuration to include this limit.
    

**Using AWS CLI:**

1.  Use the following command to run a Docker container with a PID limit:
    

aws ssm send-command --document-name "AWS-RunShellScript" --targets "Key=instanceIds,Values=instance\_id" --parameters 'commands=\["docker run --pids-limit 100 my\_container\_image"\]'

**Backout Plan:**

**Using AWS Console:**

1.  Connect to the EC2 instance.
    
2.  Edit the Docker run command to remove or adjust the \--pids-limit option to a higher value or to the default.
    
3.  Restart the Docker container with:
    

docker restart <container\_id>

**Using AWS CLI:**

1.  Use SSM to run the container without the PID limit or with a higher value:
    

aws ssm send-command --document-name "AWS-RunShellScript" --targets "Key=instanceIds,Values=instance\_id" --parameters 'commands=\["docker run my\_container\_image"\]'

**References:**

-   CIS Docker Benchmark v1.7
    
-   Docker Documentation: [https://docs.docker.com/](https://docs.docker.com/)

## Related compliance guidance

- [SOC 2 compliance: a practical implementation guide for cloud-native SaaS teams](https://support.icompaas.com/compliance/soc-2-trust-services-criteria): Configuration checks like this one are the technical half of a SOC 2 / ISO 27001 programme — the guide shows where they fit, what else an auditor expects, and how to evidence them.
- [ISO/IEC 27001:2022 compliance: a practical implementation guide](https://support.icompaas.com/compliance/iso-27001-2022): ISO 27001 Annex A.8 (technological controls) is where cloud hardening evidence lands; the guide shows how to run the ISMS around it.
