How to install Docker Desktop on Ubuntu?

Usually running and managing Docker container images on the command line can often be intimidating for Docker beginners, and that's where Docker Desktop comes in.

Developed by Docker, Docker Desktop is a free and user-friendly GUI application that allows users to easily run and manage Docker containers and images on a Linux PC without executing commands on the CLI.

Docker Desktop is a cross-platform application, which means you can install it on Windows, Linux, and Mac. It's free for companies with 250 or fewer employees, and a paid subscription is required for companies over 250.

In this tutorial, we will walk you through installing Docker Desktop on Ubuntu 22.04.

Prerequisites

  • 64-bit CPU with Virtualization Support enabled.
  • At least 4GB RAM
  • A GUI desktop environment (Preferably GNOME, MATE, or KDE )
  • A Sudo User with admin rights

(1) Confirm that KVM virtualization is enabled

To confirm that the KVM module is loaded, run the command

$ lsmod | grep kvm

If the module is loaded, you should get the following output. Indicates that the KVM module of the Intel CPU is enabled.

lsmod-kvm-module-ubuntu-linux

If the module is not loaded, execute the following command

For Intel processors

$ sudo modprobe kvm_intel

For AMD processors

$ sudo modprobe kvm_amd

(2) Install Docker on Ubuntu 22.04

The next step is to install Docker, first update the package list and install the necessary dependencies as shown below

$ sudo apt update
$ sudo apt install software-properties-common curl apt-transport-https ca-certificates -y

Once installed, add Docker's GPG signing key.

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

Next, add the official Docker repository to the system as follows

$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

With the repository in place, install Docker and other Docker tools as shown.

$ sudo apt install docker-ce docker-ce-cli containerd.io uidmap -y

Apt-Install-docker-container-io-ubuntu-linux

After the installation is successful, use the following command to add the user account to the Docker group

$ sudo usermod -aG docker $USER
$ newgrp docker

To verify that docker is running, execute the following command

$ sudo systemctl status docker

Docker-Service-Status-Ubuntu-Linux

You can also check the version and other information of your Docker installation as shown

$ docker version

Docker-version-Command-Output-Linux

(3) Install Docker Desktop

Docker Desktop is not currently available on the official Ubuntu repositories or on Docker itself. Therefore, you need to manually download the Debian binaries from the official Docker website .

The current latest version of Docker Desktop is version 4.15.0, which can be downloaded using the wget command as shown below.

$ wget https://desktop.docker.com/linux/main/amd64/docker-desktop-4.15.0-amd64.deb

wget-command-download-docker-desktop

Alternatively, you can click the link below the Linux DEB.

Download-Docker-Desktop-Ubuntu-Linux

After downloading the file, run the following apt command to install Docker Desktop

$ sudo apt install ./docker-desktop-*-amd64.deb

apt-install-docker-desktop-debian-binary

(4) Start Docker Desktop

Once Docker Desktop is installed, you can search for it and launch it using the application manager, as shown.

Launch-Docker-Desktop-Ubuntu-Linux

You can also launch on the command line as shown below.

$ sudo systemctl --user start docker-desktop

After launching Docker Desktop, the following popup box will appear, click Accept to accept the license terms.

Docker-Subscription-Service-Agreement-Ubuntu

After a short while, the Docker Desktop GUI dashboard will start. It takes about 3-5 minutes to initialize and start, so be patient.

Docker-Desktop-Starting-Window-Ubuntu

For tips on how to use Docker, click the Get Started button. If you do not wish to visit, just click Skip.

Skip-Tutorial-Docker-Desktop-Ubuntu

Finally, you'll be taken to the Docker Desktop home page, which has instructions on how to get started with containers, as shown below.

Run-sample-container-docker-desktop-ubuntu

(5) Configure Docker Desktop

Docker Desktop is highly configurable, you can tweak almost every setting to suit your liking.

These settings are divided into the following categories:

  • General
  • Resources
  • Docker Engine
  • Experimental Features
  • Kubernetes
  • Software Updates
  • Extensions

To access these settings, click on the top gear icon and the Settings tab will bring up the above options.

Docker-Desktop-Settings-Ubuntu

For example, in the Resource Tab page, you can configure the system resources required by Docker Desktop, such as cpu, RAM, Swap space, etc.

Docker-Desktop-Resources-Configure-Ubuntu

(6) Use Docker Desktop to run the container

After you have configured Docker Desktop according to your preferences, you can start running containers. For example, we will run a Redis container.

Run-Redis-Container-via-Docker-Desktop

In the popup that appears, select the directory into which the container image will be pulled.

Directory-Publish-Container-Docker-Desktop

Docker Desktop will start pulling the container image from Docker hub and create a Redis container instance.

pulling-redis-image-docker-desktop-ubuntu

After pulling the image, a container will be created and the following overview dashboard will be displayed.

Redis-container-running-logs-docker-desktop

You can click the Containers tab to view and manage all containers on the system (whether they are running or stopped).

View-Containers-Docker-Desktop-Ubuntu

Similarly, you can click the Images tab to view and manage pulled container images.

Images-Pulled-Docker-Desktop-Ubuntu

(7) Uninstall Docker Desktop

If you no longer need Docker Desktop, you can uninstall it with the following command.

$ sudo apt purge docker-desktop

Then delete the related Docker Desktop files

$ rm -r $HOME/.docker/desktop
$ sudo rm /usr/local/bin/com.docker.cli

my open source project

Kugua Cloud Classroom - Online Education Solution

Guess you like

Origin blog.csdn.net/xiaochong0302/article/details/128691860