https://github.com/mconf/docker-resource-limit-check
https://github.com/mconf/docker-resource-limit-check
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/mconf/docker-resource-limit-check
- Owner: mconf
- Created: 2017-11-14T17:01:31.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-11-16T17:50:12.000Z (over 7 years ago)
- Last Synced: 2025-02-05T20:01:15.519Z (4 months ago)
- Language: Python
- Size: 3.91 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# docker-resource-limit-check
This is for testing wether the resource limitations for a container will work on a given host. Generate the container and run it with the flags and script according to what you wish to test.
For testing memory limits, use:
```
docker run --memory-swappiness=0 -m g --memory-swap g ./eat_memory.py
```These flags will limit the container's memory at `` gigabytes and will prevent the container from using swap. `--memory-swap` depend on some kernel functionalities that might not be available or enabled, so instead of limiting the swap with `--memory-swap` we use `--memory-swappiness=0` and prevent swap altogether.
The script we use for consuming memory inside the container was adapted from [this stackoverflow post](https://stackoverflow.com/questions/6317818/how-to-eat-memory-using-python).
For testing cpu limits, use:
```
docker run --cpu="" ./consume_cpu.py
```This will limit at `` the number of cpus available to the container.
See more:
[Limiting container resources](https://docs.docker.com/engine/admin/resource_constraints/)
[Enable kernel capabilities](https://docs.docker.com/engine/installation/linux/linux-postinstall/#your-kernel-does-not-support-cgroup-swap-limit-capabilities)
[Checking container metrics](https://blog.docker.com/2013/10/gathering-lxc-docker-containers-metrics/)