We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Resource Limits

When you notice a container's using too many resources, if you don't have the time or the ability to "fix" the code, you can limit the resources the container has available. The docker run command has a few options for limiting resources:

  • --memory: Limit the memory available to the container
  • --cpus: Limit the CPU time available to the container

Assignment

  1. docker run -d --cpus="0.25" --name cpu-stress alexeiled/stress-ng --cpu 2 --timeout 10m
    

    Here, --cpus="0.25" is a Docker flag. --cpu 2 comes after the image name, so it's passed to stress-ng.

Being able to monitor container resources is crucial for maintaining healthy container environments, especially in production settings.

Run and submit the CLI tests.