85

In recent c't (sadly paywalled) there is an article about Snap and Flatpak.

enter image description here

This sounds very similar to Docker, lots of concepts are the same. Now my question what's the difference between Snap and Docker? Are those different use cases?

109

You might find Mark Shuttleworth's talk "Why we need a different container purely for apps" at Container Camp relevant to your question. He talks generally about VMs, containers and Docker at the start, continuing on to snaps and how they fit in about nine minutes in. Here's my summary:

  • Different types of containers look the same but are used for different purposes.
  • Containers don't really exist at the kernel level. Different sorts of illusions are possible. Independently we can create illusions about what users, network, disk and processes a container sees.
  • Different types of containers are really about different classes of the illusions that are created.
  • Snaps are:
    • Immutable, but still part of the base system.
    • Integrated in terms of network, so share the system IP address, unlike Docker, where each container gets its own IP address.
    • In other words, Docker gives us a thing there. Snaps gives us a thing here. For example, on a desktop, a snap provides an app right on it.
    • A snap can't pollute the rest of the system. It's in its own box. But it can still see (read-only) the rest of the system, which allows it to talk and integrate with the system.

You asked about different use cases compared to Docker. Here's one that snaps can do, but Docker cannot: desktop apps. Third parties can ship desktop apps using snaps, and users can easily install and update them. A Docker container can't (easily) interact with the user graphically on the screen, load documents from the user's home directory, or provide video conferencing via the user's webcam. Snaps can (once given permission).

You might ask how this is better than using PPAs. But in comparison to Docker, that's like asking how Docker is better than installing dependencies on a system by hand. It's better, but exactly how would probably be best answered in a separate, non-Docker-specific question.

  • 3
    This is not true. Docker can interact with desktop applications (once given permission). github.com/jamrizzi/docker-gtk – Jam Risser Jan 19 '18 at 3:21
  • 2
    This sounds like Sandboxie for windows. Sandboxed programs can open dialogs, access all local files, but when they write, they just write into their sandbox. – feedc0de Jan 24 '18 at 13:24
  • 1
    What does that tool you link to do differently than a normal docker? You can mount your x11 socket into the docker without any special docker version. – feedc0de Jan 24 '18 at 13:25
  • 1
    It's not a tool, it's a demonstration – Jam Risser Feb 14 '18 at 20:54
  • 1
    @jamrizzi It looks like what you do is simply giving docker access to the X11 socket in a script. This is quite far from having the user involved in anyway in this process (where is the "Docker wants to access the Display. Cancel or Allow?" dialogue?) – Thorbjørn Ravn Andersen May 8 '18 at 14:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.