How to install Docker using SNAP on Ubuntu Linux

One of the quickest ways to get Docker on Ubuntu Linux such as 22.04, 20.04, and other versions is using the SNAP command, here we learn how to use it.

Docker doesn’t need an introduction to those who are dealing in containerized-based apps. It is already used globally by hundreds of enterprises and developers. However, those who want to install the latest version of Docker on Ubuntu using the APT package manager require adding an official repository of it manually. So, those who don’t want to do that can go for SNAP package manager which is also available in Ubuntu out of the box.

Before following this tutorial remember the working directions of Docker installed via Snap will be different because it installs the application in an isolated environment, unlike APT.

Installing Docker on Ubuntu using SNAP


We don’t need any special requirements to follow this tutorial, just like to install any other software on Ubuntu you also need sudo privileges for Snap commands as well.

Step 1: Update System Packages

Although it is not necessary to start with the system update command on Terminal because we are about to use the SNAP command line. However, it is better to update your packages for better security.

sudo apt update && sudo apt upgrade

Step 2: Install Docker via SNAP

In all modern Ubuntu systems, Snap is available as a pre-configured package manager to use for installing a wide range of applications in an isolated environment. So, on your command terminal, just run the given command and you will have the latest version of Docker.

sudo snap install docker

The process could take some as SNAP downloads all the required files for setting up Docker.

Step 3: Create a Docker Group

Unlike Docker installation using the APT package manager SNAP will not create a group called ‘docker’ by default. And we need it, if we want to use the Docker command without sudo. Therefore, use the given command to add a group called – Docker.

sudo addgroup --system docker

Step 4: Run Docker Command without sudo

After adding the docker group also add your current user in it, so that you can use Docker commands without sudo rights.

sudo adduser $USER docker
newgrp docker

Sometimes, even after running newgrp command terminal couldn’t recognize the added user in the group immediately, in such a case simply log out and log in again.

Step 5: Disable and Enable Snap Docker

You also need to disable and enable Snap’s Docker service to apply the changes you have made.

sudo snap disable docker
sudo snap enable docker

Step 5: Create your first Container

Now, we can use the Docker command to start creating the required containers, here is an example if you are new to it.

In this example, we are downloading the Debian docker image and creating a container using it.

docker pull debian

Create container:

docker create -it --name test debian

Start container

docker start test

Get the command line of the installed container:

docker attach test


In case, if you think Docker installed using Snap creating some problems and want to remove it, then here is the command to follow:

sudo snap remove docker

Other Articles:

Leave a Comment

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