Install Docker Desktop on Ubuntu

Megha SharmaMegha Sharma
4 min read

👉 Prerequisites

To install Docker Desktop successfully, you must:

  1. Meet the system requirements

👉 General system requirements

To install Docker Desktop successfully, your Linux host must meet the following general requirements:

  • 64-bit kernel and CPU support for virtualization.

  • KVM virtualization support. Follow the KVM virtualization support instructions to check if the KVM kernel modules are enabled and how to provide access to the KVM device.

  • QEMU must be version 5.2 or later. We recommend upgrading to the latest version.

  • systemd init system.

  • Gnome, KDE, or MATE Desktop environment.

  • For many Linux distros, the Gnome environment does not support tray icons. To add support for tray icons, you need to install a Gnome extension. For example, AppIndicator.

  • At least 4 GB of RAM.

  • Enable configuring ID mapping in user namespaces, see File sharing.

  • Recommended: Initialize pass for credentials management.

  1. Have a 64-bit version of either the latest LTS version (Ubuntu Jammy Jellyfish 22.04) or the current non-LTS version (Ubuntu Mantic Minotaur 23.10). Docker Desktop is supported on x86_64 (or amd64) architecture.

  2. For non-Gnome Desktop environments, gnome-terminal must be installed:

     $ sudo apt install gnome-terminal
    

    👉 Install Docker Desktop

    Recommended approach to install Docker Desktop on Ubuntu:

    1. Set up Docker’s package repository. See step one of Install using the apt repository.

    2. Download latest DEB package.

    3. Install the package with apt as follows:

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

There are a few post-install configuration steps done through the post-install script contained in the deb package.

The post-install script:

  • Sets the capability on the Docker Desktop binary to map privileged ports and set resource limits.

  • Adds a DNS name for Kubernetes to /etc/hosts.

  • Creates a symlink from /usr/local/bin/com.docker.cli to /usr/bin/docker. This is because the classic Docker CLI is installed at /usr/bin/docker. The Docker Desktop installer also installs a Docker CLI binary that includes cloud-integration capabilities and is essentially a wrapper for the Compose CLI, at/usr/local/bin/com.docker.cli. The symlink ensures that the wrapper can access the classic Docker CLI.

👉 Launch Docker Desktop

To start Docker Desktop for Linux, search Docker Desktop on the Applications menu and open it. This launches the Docker menu icon and opens the Docker Dashboard, reporting the status of Docker Desktop.

Alternatively, open a terminal and run:

$ systemctl --user start docker-desktop

After you’ve successfully installed Docker Desktop, you can check the versions of these binaries by running the following commands:

$ docker compose version
Docker Compose version v2.17.3

docker --version
Docker version 23.0.5, build bc4487a

docker version
Client: Docker Engine - Community
 Cloud integration: v1.0.31
 Version:           23.0.5
 API version:       1.42
<...>

To enable Docker Desktop to start on sign in, from the Docker menu, select Settings > General > Start Docker Desktop when you sign in to your computer.

Alternatively, open a terminal and run:

$ systemctl --user enable docker-desktop

To stop Docker Desktop, select the Docker menu icon to open the Docker menu and select Quit Docker Desktop.

Alternatively, open a terminal and run:

$ systemctl --user stop docker-desktop

👉 What is the difference between Docker Desktop for Linux and Docker Engine?

Docker Desktop for Linux provides a user-friendly graphical interface that simplifies the management of containers and services. It includes Docker Engine as this is the core technology that powers Docker containers. Docker Desktop for Linux also comes with additional features like Docker Scout and Docker Extensions.

The Docker CLI can be used to interact with multiple Docker Engines. For example, you can use the same Docker CLI to control a local Docker Engine and to control a remote Docker Engine instance running in the cloud. Docker Contexts allow you to switch between Docker Engines instances.

While it’s possible to run both Docker Desktop and Docker Engine simultaneously, there may be situations where running both at the same time can cause issues. For example, when mapping network ports (-p / --publish) for containers, both Docker Desktop and Docker Engine may attempt to reserve the same port on your machine, which can lead to conflicts ("port already in use").

When installing Docker Desktop, a dedicated “desktop-linux” context is created to interact with Docker Desktop. Docker Desktop automatically sets its own context (desktop-linux) as the current context. This means that subsequent Docker CLI commands target Docker Desktop. On shutdown, Docker Desktop resets the current context to the default context.

Use the docker context ls command to view what contexts are available on your machine.

$ docker context ls
NAME            DESCRIPTION                               DOCKER ENDPOINT                                  ...
default *       Current DOCKER_HOST based configuration   unix:///var/run/docker.sock                      ...
desktop-linux                                             unix:///home/<user>/.docker/desktop/docker.sock  ...

If you have both Docker Desktop and Docker Engine installed on the same machine, you can run the docker context use command to switch between the Docker Desktop and Docker Engine contexts. For example, use the "default" context to interact with the Docker Engine:

$ docker context use default
default
Current context is now "default"

And use the desktop-linux context to interact with Docker Desktop:

docker context use desktop-linux
desktop-linux
Current context is now "desktop-linux"
0
Subscribe to my newsletter

Read articles from Megha Sharma directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Megha Sharma
Megha Sharma

👋 Hi there! I'm a DevOps enthusiast with a deep passion for all things Cloud Native. I thrive on learning and exploring new technologies, always eager to expand my knowledge and skills. Let's connect, collaborate, and grow together as we navigate the ever-evolving tech landscape! SKILLS: 🔹 Languages & Runtimes: Python, Shell Scripting, YAML 🔹 Cloud Technologies: AWS, Microsoft Azure, GCP 🔹 Infrastructure Tools: Docker, Terraform, AWS CloudFormation 🔹 Other Tools: Linux, Git and GitHub, Jenkins, Docker, Kubernetes, Ansible, Prometheus, Grafana