After some crashes with a docker container with a too low mem_limit, how can i check in a container the mem_limit of this container? I want to print an error message on startup and exit if the mem_limit is set to low.
相关问题
- Docker task in Azure devops won't accept "$(pw
- Unable to run mariadb when mount volume
- Unspecified error (0x80004005) while running a Doc
- What would prevent code running in a Docker contai
- How to reload apache in php-apache docker containe
The memory limit is enforced via cgroups. Therefore you need to use
cgget
to find out the memory limit of the given cgroup.To test this you can run a container with a memory limit:
Run this within your container:
Docker 1.13 mounts the container's cgroup to
/sys/fs/cgroup
(this could change in future versions). You can check the limit using:Worked for me in the container, thanks for the ideas Sebastian