Mount /dev/shm/ Volume

Trexx

Dabbler
Joined
Apr 18, 2021
Messages
29
If you are using the Launch Docker button, you would just map a dataset location such as ‘/mnt/zpool/docker/shinob’ on your TrueNas Scale to /dev/shm on the shinobi docker container.
 

vega2004

Dabbler
Joined
Apr 18, 2021
Messages
19
Yes it is simple to map this to a pool dataset but it is required to put in /dev/shm/ in the RAM how can I map the host /dev/shm to the docker container
 

shadofall

Contributor
Joined
Jun 2, 2020
Messages
100
You will probably need to create an actual app chart for this..there is/was an issue with k8s and shm that required some code in the chart for shm to work around the issue.. Search this forum for /dev/shm. And find the zonemider thread for reference. In short Shinobi won't be an easy launch docker button install
 

vega2004

Dabbler
Joined
Apr 18, 2021
Messages
19
Yeah I saw this but it was not cearl what I have to change where. Is it possible in the future to select in the GUI a host path like /etc/ or /dev/ ?
 

ornias

Wizard
Joined
Mar 6, 2020
Messages
1,458
Yeah I saw this but it was not cearl what I have to change where. Is it possible in the future to select in the GUI a host path like /etc/ or /dev/ ?
Technically the GUI has that option, however: It's INSANELY onwise to use except when you really want to mount devices.
Thats also why it isn't implemented.

It's also not how you make a ramdisk in K8S, K8S does this differently than docker.
You can just create an empty-dir volume with ram backend in k8s. This is the secure equivalent of mounting /dev/shm.

I'll check it, but this should already be possible with TrueCharts. If it isn't i'll make sure I enable it.
 

vega2004

Dabbler
Joined
Apr 18, 2021
Messages
19
But a ramdisk has the disadvantage when I create a 8GB ramdisk the memory is blocked for the OS also if the docker images is using only 2GB of the ramdisk. Is this correct? How does it work with other mounted devices like USB devices. I'm aware the /dev/smh is critical one but also often used
 

ornias

Wizard
Joined
Mar 6, 2020
Messages
1,458
No, thats not always correct.

/dev/shm, for example, is nothing more than a ramdisk.
I rather focus on implementing it, which i'm actually doing as we speak, than to explain all different types of ramdisks.

/dev/shm is not how you deploy ram storage on K8S, period. It's simply not how you do things.

I'll ignore the USB question, because it isn't relevant. Ramstorage is not deployed the same as usb devices on k8s.
 

ornias

Wizard
Joined
Mar 6, 2020
Messages
1,458
I just merged ram-based storage for persistence to TrueCharts.
Another addition to allow the same for hostPathMounts should be merged witin a few hours :)


---
Edit:
New version with ` emptyDir.medium` support are public.
Which is the actual way in k8s to store things into memory :)
 
Last edited:
Top