supereagle / experiences

Summary of practical experience in work.
2 stars 0 forks source link

The minimum memory limit allowed for Docker is 4MB #37

Closed supereagle closed 7 years ago

supereagle commented 7 years ago

Phenomenon

When the memory limit in k8s container spec is less than 4MB, the pod will can not be created and will be always in ContainerCreating. You will easily meet this problem when use m as the memory unit, because m is just 1/1000 byte, which is too small. So m can be used for memory, but it is not recommended.

Analysis

You can refer to Docker Doc, or verify by the command:

# docker run -m 128 nginx:latest
/usr/bin/docker-current: Error response from daemon: Minimum memory limit allowed is 4MB.

I think this limitation is not set by Docker, but the requirement of Linux kernel. When the memory limit is less than 4MB, the created container will be immediately stopped by oom-killer.