Setup Docker Desktop on Ubuntu for Beginners

Ubuntu is a versatile Operating System and when I started using it, I started needing it everywhere. I had windows in past and now I have Intel based macbook, but I always had a VM with Ubuntu. There are many things I would like to still do in Ubuntu, like setting up servers and clusters. Today when we talk about the docker setup, we will be talking about the same Ubuntu. For this post I will be using the Ubuntu VM setup in a VM hosted by VMWare Fusion. I will be using the current LTS version (22.04) of Ubuntu Desktop (this makes it possible to capture few screenshots for this post).

Prerequisite: VM Setup

In case you are interested in knowing how to setup a VM in fusion, you can search youtube (I will put some tutorial links here from my content as and when they are ready). For now you can read / watch my old post / video here, which is based on the Microsoft Windows edition of VMWare Workstation. In case you have a server host linke GCP, Azure, AWS or Linode you can create a VM there too, the choice is yours. The only thing you have to remember that if you are opting for the VM route, you will need to enable virtualization in the VM setting.

About Docker

If you guy are here then I am sure that you have a very basic idea about docker or have seen or heard someone talking about this. I am sure you are are amazed with their talks and are definitely interested in learning more about that. I am not going to touch in detail about docker in this post, but promise you that I will be posting more about Docker in future. For know, just understand in plan English that docker is a software which has the capability of running your applications in an isolation from the rest of the system (know as containers). It seems and behaves like tiny vm only but it is sharing the underlying infrastructure. In simple words it doesn’t virtualize the hardware at all.

Linux and Docker

These 2 systems walks hand in hand. Take Ubuntu (Linux) as host to run Docker to run containers which are based on linux based (though there are images of other OS too), images. I am sure there will be people coming back at me on the above statement, but believe me that the most beautiful marriage in the world ever. In case of server environments there are 2 major players (as host for docker), Windows and Linux. We will also be using this docker setup in future posts to set up various things and learn more. So, let’s get started.

Setup

By this point I am sure you already have an Ubuntu machine running somewhere (VM, Laptop, Cloud / Datacenter) and have been patiently waiting on the text above. So I will not waste anymore time of yours.

First thing First – Update

As a ubuntu user, I always prefer to run apt update before any software installation, which impacts the system. So open the terminal (press ctrl + alt + t)

$ sudo apt update

Start Setup

Now before we proceed, I need to tell you that I will be setting up a Docker Desktop edition, which comes with some ui to interact with (and take a few screenshots for this post). There is another variant which is generally used on the servers and have no UI (portainer a nice tool to know in case of docker setup on headless servers).

To get the docker desktop headover to the docker official website here. You will see the instructions over there and try to follow them here. In the beginning there are some instructions to remove the older version of docker engine in case you already have the installed (as innocent mistake while trying to figure out the length and breadth of docker by following some older posts / videos). You can skip those steps as in our case we have a fresh installation of the operating system (I am assuming). Since we have already updated the system we can directly run the below command in your terminal.

$ sudo apt install ca-certificates curl gnupg lsb-release

The above command will install some the required packages (don’t worry, in case you know that some these packages are already installed on your system). No create a foder for the keyrings as follows (again don’t worry in case you already have the folder on your machine).

$ sudo mkdir -p /etc/apt/keyrings

now get the GPG in that folder by executing the below command.

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

Now it is the time to setup the repository using the command below

$ echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

You are ready at this point to download and install Docker Desktop. But since we did some system changes like adding a new repository, we are required to run the apt update again. Remember that it may all fail if the above step is ignored or missed.

last command in preparation is as flows

$ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin

Download the latest version of the Docker Desktop

Jump over to this link and download the DEB package by clicking the link provided on the page. I am not intentionally pasting this direct down link here is because, future readers may not find anything here, since the external site has updated the link. Once downloaded you will see the .deb package in the folder where you downloaded the file (default is Downloads folder).

Downloads in Firefox Library
files in the Downloads folder

Open that folder in terminal and execute the following command.

$ sudo apt install ./docker-desktop-<version>-<arch>.deb

Above command will take a few seconds to setup the docker desktop. You have successfully installed the Docker Desktop now. Before you run the application go ahead and restart the machine. Once the machine is restarted navigate to terminal and execute the following command.

$ systemctl --user start docker-desktop

Or you can find the docker Desktop application in your applications list, just click to open the same.

Docker Desktop Service Agreement Screen

That’s all folks, you have docker desktop running happily on your ubuntu machine. In case you have any questions, please don’t hesitate to put them in the comments. I will be happy to answer them all as soon as possible.

Thanks for reading!

Published by

Anant Anand Gupta

Thinker, Innovator and Entrepreneur

Leave a Reply