{"id":189,"date":"2020-09-26T13:16:37","date_gmt":"2020-09-26T13:16:37","guid":{"rendered":"https:\/\/dft.wiki\/?p=189"},"modified":"2026-06-09T15:01:36","modified_gmt":"2026-06-09T19:01:36","slug":"snap-vs-docker-vs-multipass","status":"publish","type":"post","link":"https:\/\/dft.wiki\/?p=189","title":{"rendered":"Snap vs Docker vs Multipass"},"content":{"rendered":"<p>The difference between Snap, Docker, and Multipass can be easily understood through one example:<\/p>\n<p>Let&#8217;s suppose you need a LAMP stack to run code and possibly share content on the Internet. There are four ways to do it:<\/p>\n<p>1st &#8211; <strong>The conventional way<\/strong> (reference) involves manually installing Apache, PHP, and MySQL <strong>on<\/strong> the host OS. The services use all the libraries, kernel, and resources from the host OS. The software merges into your system, sharing files, permissions, etc. If one service crashes, the whole host OS can become inoperative, and if one service has a vulnerability, all data becomes vulnerable.<\/p>\n<p>2nd &#8211; <strong>The Snap way<\/strong> downloads and installs a self-contained package called a &#8216;snap&#8217; <strong>on<\/strong> the OS. With minimal effort, Snap downloads and installs one capsule (an isolated app) containing all the needed services (Apache + PHP + MySQL), along with all dependencies and libraries (which is why it runs on multiple platforms). Snap starts and stops all services at once, as a single &#8216;block&#8217; application running on the OS. It carries the same crash risk as <strong>The conventional way<\/strong> (1st).<\/p>\n<p>3rd &#8211; <strong>The Docker way<\/strong> pulls (downloads) an image. This image shares the host OS kernel but creates a fully independent environment with its own users, permissions, file system, etc. This environment is called a Container and does not require a boot, so starting and stopping processes is very fast. It feels like a lightweight VM, but it is not. There is a shell to access the container, and if a service crashes inside, it will most likely not affect the host OS. The same applies to vulnerabilities: they are kept inside the container.<\/p>\n<p>4th &#8211; <strong>The Multipass way<\/strong> launches (downloads and runs) a pre-installed Ubuntu image. This creates a brand new Virtual Machine that shares nothing with the host OS, with no shared vulnerabilities or crash risk. Multipass is not a hypervisor; it is a tool to quickly and easily spin up a fresh VM in just one command using the native hypervisor, useful when you frequently need disposable VMs for testing. Inside the VM, you still need to follow <strong>The conventional way<\/strong> (1st) to install all software and services.<\/p>\n<figure class=\"wp-block-table alignwide is-style-stripes\">\n<table class=\"has-fixed-layout\">\n<tbody>\n<tr>\n<td><strong>Conventional<\/strong><\/td>\n<td><strong>Snap<\/strong><\/td>\n<td><strong>Docker<\/strong><\/td>\n<td><strong>Multipass<\/strong><\/td>\n<\/tr>\n<tr>\n<td><strong>Real Machine<\/strong> (Host).<\/td>\n<td><strong>Self-Contained<\/strong> Software.<\/td>\n<td><strong>Container<\/strong>.<\/td>\n<td><strong>Virtual Machine.<\/strong><\/td>\n<\/tr>\n<tr>\n<td><strong>Any<\/strong> Host OS.<\/td>\n<td>Cross <strong>Linux<\/strong> Distributions.<\/td>\n<td>Cross <strong>Linux<\/strong> Distributions.<\/td>\n<td><strong>Linux, Windows, or Mac.<\/strong><\/td>\n<\/tr>\n<tr>\n<td><strong>Single<\/strong> Environment.<\/td>\n<td>Runs on the <strong>Host Single<\/strong> Environment.<\/td>\n<td><strong>Multiple<\/strong> Environments.<\/td>\n<td><strong>Multiple<\/strong> (Ubuntu Only) Environments.<\/td>\n<\/tr>\n<tr>\n<td><strong>Software<\/strong> is installed <strong>on the host OS.<\/strong><\/td>\n<td><strong>Software<\/strong> is installed <strong>in a snap.<\/strong><\/td>\n<td>The <strong>image<\/strong> is run <strong>in containers.<\/strong><\/td>\n<td>The <strong>chosen Ubuntu<\/strong> version is installed in a <strong>VM.<\/strong><\/td>\n<\/tr>\n<tr>\n<td><strong>Usually<\/strong>, a new version <strong>replaces the old<\/strong> one.<\/td>\n<td>It can keep <strong>different versions<\/strong> side by side.<\/td>\n<td>Multiple containers can run <strong>different versions<\/strong>.<\/td>\n<td>Different images can be <strong>different versions<\/strong>.<\/td>\n<\/tr>\n<tr>\n<td>Start\/Stop <strong>real services<\/strong>.<\/td>\n<td>Start\/Stop <strong>like services<\/strong>.<\/td>\n<td>Start\/Stop <strong>like services<\/strong>.<\/td>\n<td><strong>Boot the whole VM.<\/strong><\/td>\n<\/tr>\n<tr>\n<td><strong>Software<\/strong> size.<\/td>\n<td><strong>Software<\/strong> size + <strong>libraries<\/strong> size.<\/td>\n<td><strong>Software<\/strong> size + <strong>image<\/strong> size (from 64 to 104MB).<\/td>\n<td><strong>Software<\/strong> size + <strong>full OS<\/strong> (from 55 to 1002MB).<\/td>\n<\/tr>\n<tr>\n<td>Host <strong>file system<\/strong>.<\/td>\n<td>.snap (<strong>Squashfs<\/strong>).<\/td>\n<td>N\/A (<strong>OverlayFS<\/strong>).<\/td>\n<td>.img (on <strong>KVM Hypervisor<\/strong>).<\/td>\n<\/tr>\n<tr>\n<td>Uses <strong>all<\/strong> hardware.<\/td>\n<td>Uses <strong>all<\/strong> hardware.<\/td>\n<td>Uses <strong>all<\/strong> hardware.<\/td>\n<td>Uses <strong>what was allocated<\/strong>: RAM, CPU, Disk, etc.<\/td>\n<\/tr>\n<tr>\n<td>Manual deletion, <strong>possible leftovers<\/strong>.<\/td>\n<td>Clean deletion, <strong>no leftovers<\/strong>.<\/td>\n<td>Clean deletion, <strong>no leftovers<\/strong>.<\/td>\n<td>Clean deletion, <strong>no leftovers<\/strong>.<\/td>\n<\/tr>\n<tr>\n<td>N\/A<\/td>\n<td><strong>Very lightweight.<\/strong><\/td>\n<td><strong>Lightweight.<\/strong><\/td>\n<td><strong>Heavyweight.<\/strong><\/td>\n<\/tr>\n<tr>\n<td>N\/A<\/td>\n<td>Loads in approx. <strong>2 seconds.<\/strong><\/td>\n<td>Loads in approx. <strong>2 seconds.<\/strong><\/td>\n<td>Loads in approx. <strong>10 seconds.<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" class=\"wp-image-254\" src=\"https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2020\/09\/image-1.png\" alt=\"\" \/><\/figure>\n<p>My opinions on which applications fit best with each approach:<\/p>\n<figure class=\"wp-block-table alignwide is-style-stripes\">\n<table class=\"has-fixed-layout\">\n<tbody>\n<tr>\n<td><strong>Conventional<\/strong><\/td>\n<td><strong>Snap<\/strong><\/td>\n<td><strong>Docker<\/strong><\/td>\n<td><strong>Multipass<\/strong><\/td>\n<\/tr>\n<tr>\n<td>If you have a <strong>physical machine dedicated to a single purpose<\/strong>, this is the best option. It has full hardware access and <strong>best performance<\/strong> with no overhead.<\/td>\n<td><strong>Easy and clean installation<\/strong> of full software packages. It can deploy complex systems with all supporting services, such as database servers, and <strong>everything comes pre-configured and ready to use.<\/strong><\/td>\n<td>Excellent for <strong>keeping all services isolated<\/strong> and protecting the whole system and data, <strong>without running many VMs in parallel<\/strong>, which would cause significant overhead.<\/td>\n<td>For production servers, this is the <strong>most powerful and reliable<\/strong> way to keep services isolated, reducing vulnerabilities and protecting data and the system. It <strong>requires capable hardware<\/strong> with sufficient CPU, RAM, disk, etc.<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>How to Use<\/td>\n<td><a href=\"https:\/\/dft.wiki\/?p=163\">How to Use<\/a><\/td>\n<td><a href=\"https:\/\/dft.wiki\/?p=197\">How to Use<\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<p><strong>REFLECTION NOTES<\/strong><\/p>\n<p>The use case will define which method best fits the need, but a few key decision points are worth mentioning:<\/p>\n<ul>\n<li>What is the scope? A system or an application?\n<ul>\n<li>If a system:\n<ul>\n<li>Does it require direct hardware access and minimal overhead? Like a high-throughput NAS, for example?\n<ul>\n<li><strong>Conventional &#8211; Bare-metal server<\/strong><\/li>\n<\/ul>\n<\/li>\n<li>Does it tolerate some overhead and benefit from features like snapshots, high availability, or live migration?\n<ul>\n<li><strong>Multipass &#8211; Virtual Machine<\/strong><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>If an application:\n<ul>\n<li>Can it be classified as a microservice, fully decoupled from the underlying system?\n<ul>\n<li><strong>Docker &#8211; Containerization with Orchestration<\/strong><\/li>\n<\/ul>\n<\/li>\n<li>Is it a monolithic application that can benefit from AppArmor and Seccomp security policies plus delta updates?\n<ul>\n<li><strong>Snap &#8211; Application Packages<\/strong><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<hr \/>\n<p><strong>BONUS<\/strong><\/p>\n<p>Containerization is the direction the industry is heading these days. The full decoupling of the application from the underlying system makes it easy to migrate workloads across different hosts, scale in and out quickly, and spin up ephemeral workers that are created and destroyed in no time.<\/p>\n<p>Check out the Open Container Initiative (OCI) for more information about what makes containers so versatile [<a href=\"https:\/\/opencontainers.org\/\">Link<\/a>].<\/p>\n<p>And definitely read more about Container Orchestration in the following posts:<\/p>\n<p><strong>MicroK8s<\/strong> on Ubuntu 22.04 [<a href=\"https:\/\/dft.wiki\/?p=3151\">Link<\/a>].<\/p>\n<p><strong>Minikube<\/strong> on Ubuntu 22.04 [<a href=\"https:\/\/dft.wiki\/?p=3087\">Link<\/a>].<\/p>\n<p><strong>K3s<\/strong> on Ubuntu 22.04 [<a href=\"https:\/\/dft.wiki\/?p=3105\">Link<\/a>].<\/p>\n<p><strong>K8s<\/strong> Persistent Volumes [<a href=\"https:\/\/dft.wiki\/?p=1435\">Link<\/a>].<\/p>\n<p><strong>K8s<\/strong> Cheat Sheet [<a href=\"https:\/\/dft.wiki\/?p=1372\">Link<\/a>].<\/p>\n<p><strong>K8s<\/strong> Dashboard [<a href=\"https:\/\/dft.wiki\/?p=4114\">Link<\/a>].<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The difference between Snap, Docker, and Multipass can be easily understood through one example: Let&#8217;s [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-189","post","type-post","status-publish","format-standard","hentry","category-general"],"_links":{"self":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/189","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=189"}],"version-history":[{"count":6,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/189\/revisions"}],"predecessor-version":[{"id":5850,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/189\/revisions\/5850"}],"wp:attachment":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=189"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=189"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=189"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}