Is docker tmpfs working on wsl2.
If I run this in WSL2:
docker run -it --rm -e POSTGRES_PASSWORD=secret --tmpfs /var/lib/postgresql/data postgres:13-alpine sh
The whole container will run in the RAM?
Is docker tmpfs working on wsl2.
If I run this in WSL2:
docker run -it --rm -e POSTGRES_PASSWORD=secret --tmpfs /var/lib/postgresql/data postgres:13-alpine sh
The whole container will run in the RAM?
[EDIT] As @Nik found,
tmpfs
in WSL is currently mapped to filesystem. At command line level it works as it is mapped in RAM, but it is actually mapped to filesystem. So, take care of this caveat until it is implemented as one would assume.According to your first question: "Is docker tmpfs working on wsl2?" it seems the answer is yes. In fact, try to run a container like that:
If you then inspect the container, you can see that
/mytmp
is mounted correctly as atmpfs
:Some notes about your second question "The whole container will run in the RAM?":
It's just the content of the folder
/var/lib/postgresql/data
that is stored in RAM, not the "whole container" whatever you think that means.It seems to me you're not running the db but a shell instead. So, unless you start the db from the shell I guess you would have no particular advantages in having
/var/lib/postgresql/data
in RAM.Technically speaking any program has to be loaded in RAM to work, or at least the portion that is currently executed.