jlesage / docker-baseimage-gui

A minimal docker baseimage to ease creation of X graphical application containers
MIT License
1.2k stars 179 forks source link

Zram? #117

Closed jokomad closed 11 months ago

jokomad commented 11 months ago

Any tutorial on how to add zram... no luck so far from google...

jlesage commented 11 months ago

You are talking about the kernel module ? Can you give more details about what you want to do ?

jokomad commented 11 months ago

Sorry for the late reply. Goal is to make docker use less ram for firefox or chrome... Tried zram-init from alpine repo... Using docker windows... Seems i need modified kernel for WSL... hoped some startup script would solve it easy...

jlesage commented 11 months ago

Unless I'm missing something, I don't think zram will help. zram allows you to create a disk in RAM. It's not a system-wide compression technology.

jokomad commented 11 months ago

Wanted to try out... Hoped it involved some startup script... But changing docker kernel is too much. Thanks anyway...

jlesage commented 11 months ago

So the kernel module could theoretically be loaded from the container. However, doing this won't reduce memory used by the container. zram is usually used for in-RAM folders, like /tmp. In the container, this folder doesn't contain a lot of data...

jokomad commented 11 months ago

If this is true from google about zram: The way it extends the amount of available RAM to a system is by using a portion of the RAM as compressed swap. It can therefore hold more pages of memory in the compressed swap than the amount of actual memory used. Typically it compresses to a 3:1 ratio... any chance to share tutorial on how to load zram from the container theoretically. Thanks. sorry for bugging.

jlesage commented 11 months ago

The way it extends the amount of available RAM to a system is by using a portion of the RAM as compressed swap.

The swap is a way for the OS to move data from RAM to a file on the system. Swap is used when the RAM is full. So using zram to store the swap file might be beneficial for performance reason (because zram is probably faster than a hard disk), but this won't reduce the amount of memory consumed by a container.

any chance to share tutorial on how to load zram from the container theoretically.

Basically you can load a driver from a container executed in privileged mode. See https://www.baeldung.com/linux/docker-container-kernel-modules

jokomad commented 11 months ago

So even less ram with zram. Thanks for explanation. Have a good day.

jlesage commented 11 months ago

No problem!