0
I am writing because I am wondering if I am wrongly interpretating the docker online documentation. Thus I’d like to understand. Here is a docker run call
docker run -it --rm --memory=5000m --memory-swap=5000m --mount type=tmpfs,destination=/app,tmpfs-size=25000m ubuntu:22.04 /bin/bash
Inside the container, I can see the 25000m allocated to the /app mount point - this is the partial output of the df -h.
tmpfs 25G 0 25G 0% /app
This is consistent with the documentation tmpfs mounts | Docker Docs
But I am not able to write more than 5000m on /app (I tested this with dd by writing more files). Apparently, this seems to be not consistent with documentation. Indeed neither the previous link nor Runtime options with Memory, CPUs, and GPUs | Docker Docs report any interaction among --memory --memory-swap and --mount type=tmpfs
Apparently, it seems that docker is not able to distinguish between the ram allocated (5000m ) and the tmpfs. And when the tempfs reaches the --memory --memory-swap limit, the container is killed. But is this the expected behaviour?
Docker version 20.10.14, build a224086
Wrapping up… I was expecting to be able to write up to 25000m to the /app mount point with a container instantiated in this way
docker run -it --rm --memory=5000m --memory-swap=5000m --mount type=tmpfs,destination=/app,tmpfs-size=25000m ubuntu:22.04 /bin/bash
But I was not able to go beyond the limit imposed by --memory=5000m --memory-swap=5000m (even if this is not clear from the online documentation)
Specifically I am not able to execute more than this (1) dd if=/dev/zero of=/app/zero_1.img bs=1G count=2 — (2) dd if=/dev/zero of=/app/zero_2.img bs=1G count=2 . Thus I am not able to write more than 3.9G