What is the difference between apt and snap installed docker?

If you are planning to install Docker on Ubuntu or Debian-based system then you can either use the APT package manager or Snap which is a Universal package installer. However, what is the difference between having Docker from Apt and Snap, here we discuss that.

Package Manager:

Let’s first learn a little bit about these two package managers of Ubuntu.

apt (Advanced Package Tool): It is the default package manager on all Debian, Ubuntu, and other similar Linux distro systems. APT manages repositories and installs the available Debian packages (software) through them. Even it can install the locally available Debian binaries.

snap (SNAP Package Manager): On the other hand, Snap is a universal package manager because it doesn’t only restrict itself to Ubuntu or Debian-based systems like APT. Instead, we can configure and use it on all popular Linux systems including RedHat and OpenSUSE.

It is possible because the Snap packages are self-contained and include all the necessary dependencies, making them independent of the underlying system. Moreover, Snap also doesn’t rely on system repositories for its packages instead its developer (Canonical) has created a centralized SNAP store, which allows easy package distribution and updates.

So, if you use APT then Docker will either be installed via the system default repository or it’s official that you have to add manually. Whereas, Snap will directly search for it in its centralized store to install the Docker.

LearnHow to install Docker using SNAP on Ubuntu Linux

Package Isolation:

Now, you know what are APT and Snap, so if you are planning to install a package like Docker using any of them, then know how it going to interact with the system.

apt: If we install Docker or any other package through the APT, it will install system-wide to access by any other program, if required. However, sometimes, it could lead to version conflicts and dependency issues if multiple packages require different versions of the same library.

So, for example, if you already have installed Docker using the system repository and now want the latest version of Docker using its official repo then you have to first completely remove the previous version other wise there will be issues.

snap: SNAP packages are isolated, which means software installed using it will not interfere with the host system or other packages. It is because of sandboxed environment, Snap packages are isolated from the rest of the system and contain their own dependencies. This kind of package configuration offers better stability and avoids conflicts between different applications and libraries. However, this feature is not a benchmark for installing Docker using Snap because Containers are themselves run in an isolated environment.

This also means we can install two instances of the same software on a single system one is using Apt and the other via SNAP.

Working Directory

APT is tightly integrated with the host system and uses common system directories to unpack and install the packages including Docker, that’s why we can find its executable file after installation under /usr/bin/. However, this is not the case with Snap installed packages because it uses a Sandbox environment, hence all the software configured using it will be located in ~/snap directory but with their own directories.

So, to start or stop the Docker service you cannot use default the Systemctl command if it is installed using the Snap.

Working Directory for Docker


apt: Well, when it comes to updating the installed packages using the APT, packages will be updated through the regular system update command. But running it will also update all the installed packages unless you manually hold some particular one from getting updated.

snap: In SNAP the updating of packages can be done individually, which means if you only want to update Docker to its latest version but not others then we can do that. Although Snap daemon by default is set to check updates and install them in the background periodically, we can disable that, if needed. The command to do that is: snap refresh --hold and to enable the auto-update service again you can use snap refresh --unhold.

Availability of Docker Versions:

This is one of the key differences when it comes to installing Docker using Apt or Snap because the Docker version available through the default system repository of Ubuntu and APT will not be the latest one. If you want to have the latest version using the APT then we need to add the Offical Docker repository on the system manually.

However, this is not with SANP because its packages are usually maintained and provided by the upstream developers or maintainers. Hence, you will have a wider range of Docker versions directly from the SNAP store or command line, including the latest releases.

So, far we have learned what is the difference between installing the Docker package using the APT and Snap, now which to use?

If you want to use the native system working directories and system service commands for Docker then you can use the APT package manager. Because many third-party applications that require Docker can easily recognize it if installed using the APT.

Whereas, those who don’t want to add the official APT docker repository for its latest version manually can use the SNAP to get Docker with a single command.

Also, typically APT installed packages are faster because Snap uses a compressed SquashFS file system format, so when you use the Snap-installed software the system needs to decompress it, if your application is large in size then to start it the system could take some time compared to APT installed ones.

Other Articles:

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.