Snap vs system container
I have seen this: what's the main difference between Docker and Snap?
I don't quite see the difference between snap and system containers.
- VM has a separate Linux kernel and used fixed host resources using hypervisor.
- Linux Container (system container, re-uses/share the kernel, and uses dynamic host resources.
- Docker do not share the kernel, but a docker demon (early docker used Linux container) to allocate resources dynamically.
Do Snap fit between VM and Linux Containers, in the sense that it not only share the kernel but even more of the host system, without being a totally different installed OS using hypervisor?
Update: Snap is a sandbox with mediated access to the host system.
I think this slide from Mark’s presentation on Container Camp 2016 explains a lot in a single image, and makes a lot of sense to me:
Video link: Why we need a different container purely for apps - Mark Shuttleworth (Canonical) - YouTube
To sum it up in short:
- LXC/LXD are “machine containers” with a persistent filesystem that works like a VM
- Docker are “process containers” with an overlay filesystem over a static image (with options for persistent storage)
- Snaps are “application containers” that directly extends functionality of the underlying host
My personal experience:
-
I mostly use Docker for all the different web services on my home network (UniFi, Grafana/Prometheus, Bookstack, Nextcloud, Syncthing, Transmission, Proxy Manager, Iperf3 etc.), since Docker is especially well suited for isolating data and exposing ports for different services.
-
If I would ever need “VM” like functionality (where I needed to install custom packages that would persist in the container), I would take a look at LXC/LXD.
-
I have mixed feelings about snaps, and I think that depends entirely on your usecase. For those apps that are officially distributed as snaps, they might be worth it (for instance LXD or Multipass, which are both official Canonical snaps). 3rd party snaps can be of mixed quality, to say the least.