Skip to content

CICD-132 · Set a container memory limit ​

Encyclopedia · Docker runtime and Compose · All snippets

Previous · CICD-131 · Next · CICD-133

1. Where it fits ​

  • Placement Bash run step following checkout, or equivalent lab terminal.
  • Prerequisites disposable Docker or Compose project with example web service.
  • Platforms local-linux, github-actions, gitea-actions.

2. Copy the snippet ​

bash
docker run --rm --memory 256m --cpus 1 web:ci python --version

3. How it works ​

The command starts a container from the selected image under its declared network and resource options.

4. Verify the result ​

Measure resource behaviour against a fixture and inspect OOM status for long-running tests.

Validation syntax-validated (Bash parse). Status definitions.