Score:9

Snap vs system container

cn flag

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.

ChanganAuto avatar
us flag
No, snaps has nothing to do with it. It's just a new way to package software.
user535733 avatar
cn flag
The confusion is understandable. Docker is often misused as packaging -- applications that don't really need to be containerized, but the author wants to distribute them that way. And Snap packages sell their isolation and safety features, which *seems* similar to containerization at first glance, though the snap method is completely different.
Score:12
vn flag

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:

enter image description here

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.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.