A general question. Why would you use a Docker app vs a VM? Does a Docker app use less memory/disk space etc?
Generally, yes. It can also use more, if needed.
When you create a VM, you allocate resources to it–a certain number of CPU cores, a certain amount of RAM. It can’t exceed those limits. Any process in that VM that needs more, well, it’s going to have to wait. But if the software in question needs a different OS than Linux, well, a VM is the only option.
By contrast, a Docker app, unless you limit it, can use all available CPU and RAM, thus better performance. Also, of course, more potential impact on overall system performance.
The other big difference is that Docker apps have direct access to system storage, while a VM would need to have that storage shared via SMB or NFS.
Containerization, unlike virtualization, will not reproduce a physical machine but use the machine with its operating system (Truenas). So, containerization consists of isolating users, processes, file systems on the same operating system (Truenas). A bit like having several user sessions open and usable at the same time. Docker will take care of the life cycle of the containers but also the communication between the host system and the containers.
Generally Docker will consume fewer resources and use fewer memory, disk resources than virtual machines.
In my opinion Truenas is not optimized for virtualization, while Docker works very well on Truenas.
Thanks makes sense.
I think I understand. The Docker app is actually running on the shared Truenas OS within a controlled container and has access to the hardware etc. Wheras a VM is running an OS within itself with mostly simulated hardware. Right?
Yes right.
But Docker has its limitations. There may be cases where virtualization is the only or best way. Personally for my limited purposes I have not yet encountered a case. Look at my Docker applications below.
Thanks, I understand. I appreciate the info. I have a debian VM running that does a bunch of python based utitilty stuff and Ubuntu VM that is running my secondary PiHole which is the only thing it runs. I may experiment with moving this PiHole to a Docker app. I think that may save some ram/disk space.
The key here, is that a VM can run whatever kernel it wants independent of the host OS. So, in the case of TrueNAS SCALE, it can run other Linux distros cause they all still use the same kernel, but slightly different userland. You cannot run other kernels like Windows, Free/Open/Net-BSD, MacOS, etc. You would need a VM to run those other kernels.
Of interest. I have an Ubuntu VM running PI-Hole (only thing installed) and I did a benchmark test with the PI-Hole APP in the APPS collection with the same config. The APP PI-Hole is significantly faster.