Containerization is the bundling up of an application code together with related configuration files, libraries, and utilities required for it to run into a standardized unit. Before containerization deploying an application in a different environment from the one it was created on resulted in bugs and lots of errors. One could not move an application developed on a desktop to a virtual machine or software developed on windows to Linux. Containerization helps developers deploy applications easily, faster, and more secure.

A single package of software is referred to as a container. The containers are abstracted away from the operating system, that is, they do not bundle in a copy of the OS, making them stand-alone and portable and thus can run on any platform or cloud without issues. The ‘lightweight’ feature of containers allows them to share the host’s kernel removing the need to have a separate operating system.

Docker is a software platform that enables developers to deploy applications in a container and run on any operating system. It is more of an operating system for containers that provides commands to build, start, run and stop containers. Docker Engine is a core product of Docker. It is an open-source containerization technology for building applications that include its daemon and CLI.

Docker Desktop is an application that enables you to build and share containerized applications and microservices. It includes Docker Engine, Docker CLI client, Docker Compose, Docker Content Trust, Kubernetes, and Credential Helper. With docker desktop, you are able to work with your choice of development tools and programming languages which gives access to a vast library of templated from Docker Hub.

Features of Docker Desktop

  • Includes the latest version of Kubernetes.
  • Ability to develop containerized applications in multiple languages.
  • Fast and reliable performance
  • In-container developmental and debugging.
  • Automatic updates.

This guide will show you how to install Docker Desktop on KDE Neon|Kubuntu. Docker Desktop runs a VM in Linux to provide a consistent Docker Desktop experience across major operating systems and to enhance security by restricting root access to the VM.

System Requirements

  • 64-bit kernel and CPU support for virtualization
  • KVM virtualization support.
  • QEMU version 5.2 or newer.
  • systemd init system.
  • Gnome or KDE Desktop environment.
  • At least 4 GB of RAM.

Install Docker Desktop on KDE Nen / Kubuntu

Update your system packages.

sudo apt update && sudo apt upgrade -y
[ -f /var/run/reboot-required ] && sudo reboot -f

Step 1. Check for KVM support

To load KVM support use the following command.

sudo modprobe kvm

To check if the KVM modules are enabled, run the following command.

$ lsmod | grep kvm
kvm_intel             303104  0
kvm                   864256  1 kvm_intel

To check ownership

$ ls -al /dev/kvm

crw-rw----+ 1 root kvm 10, 232 May 23 23:10 /dev/kvm

Add user to the KVM group in order to access the KVM device.

sudo usermod -aG kvm $USER

Step 2. Install Docker Desktop on KDE Neon / Kubuntu

Uninstall the tech preview or beta version from your system

sudo apt remove docker-desktop

For a complete cleanup, remove the configuration files, symlink, and purge (free) the remaining systems files.

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

Setup the repository

sudo apt install ca-certificates curl gnupg lsb-release

Add the official GPG key

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Set up a stable repository using the following command

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

Download the latest package from the release page. Alternatively, you can use the following command to download it from the terminal.

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

Update your system and install the package.

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

If you get an error at the end of the installation due to installing a downloaded package. You can ignore this error message.

You can check the version of the components to confirm the installation.

$ docker compose version
Docker Compose version v2.5.1

$ docker --version
Docker version 20.10.16, build aa7e414

$ docker version
Client: Docker Engine - Community
 Cloud integration: v1.0.24
 Version:           20.10.16
 API version:       1.41
 Go version:        go1.17.10
 Git commit:        aa7e414
 Built:             Thu May 12 09:17:23 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Add your name to the docker group to avoid using sudo with docker commands.

sudo usermod -aG docker $USER

Enable the service on startup.

sudo systemctl --user enable docker-desktop

You can open the Docker desktop from the terminal with the following command.

systemctl --user start docker-desktop

Alternatively, you can do so from the application launcher.

Accept the License Agreement by checking the box and clicking Accept.

The docker-desktop homepage opens as shown below.

Docker Desktop Configuration on KDE Neon / Kubuntu

Go to the settings page. The General tab allows you to enable basic settings like weekly tips and sending usage statistics.

The Resources tab allows you to configure Memory, CPU, Disk, etc., and other resources available for docker.

The Docker Engine page allows you to configure the Docker daemon to determine how your containers run.

Experimental features allow you to enable or disable them.

Kubernetes is a standalone server included on Docker Desktop to enable you to test deploying your docker workloads on Kubernetes

Software update notifies you of any docker desktop updates.

The extensions tab allows you to choose the extensions you want to enable.

The Troubleshoot page allows you to Reset setting back to default and also restart Docker Desktop.

The Dev Environments page preview shows how developers are allowed to share local code changes and environments with their teams. However, This feature is not free and would require an upgrade

Run Containers using Docker Compose on KDE Neon / Kubuntu

On the Containers tab, you will find a code to run a sample container.

Copy the code and run it as shown below.

$ docker run -d -p 80:80 docker/getting-started
Unable to find image 'docker/getting-started:latest' locally
latest: Pulling from docker/getting-started
df9b9388f04a: Pull complete 
5867cba5fcbd: Pull complete 
4b639e65cb3b: Pull complete 
061ed9e2b976: Pull complete 
bc19f3e8eeb1: Pull complete 
4071be97c256: Pull complete 
79b586f1a54b: Pull complete 
0c9732f525d6: Pull complete 
Digest: sha256:b558be874169471bd4e65bd6eac8c303b271a7ee8553ba47481b73b2bf597aae
Status: Downloaded newer image for docker/getting-started:latest
d72e92af370136981fd83ed36cd90e777a34653fb1ff828a33bb899900076e4c

Going back to the docker desktop shows a new container up and running as shown below. The name might be different on your end as it is random.

Docker Engine and Docker Desktop

Not to get Confused, Docker Desktop is a virtual machine plus a Graphical user interface with additional extensions and plugins. Then Docker Engine runs inside the virtual machine. They can also be installed and run side by side but it is recommended to give Docker Desktop a dedicated storage location to prevent it from interfering with Docker Engine. Another possible solution is to turn off Docker Engine while using Docker Desktop to prevent it from consuming resources.

To stop Docker Engine, use the following command.

sudo systemctl stop docker docker.socket containerd

In some systems, Docker starts automatically. You can use the following command to disable it from starting automatically.

sudo systemctl disable docker docker.socket containerd

Switch between Docker Desktop and Docker engine

Docker desktop creates its own context ‘desktop-linux‘ but on shutdown, it resets to the current context which is the default for Docker Engine. Use the following command to list the context available on your machine. The one with an asterisk is the one in use currently.

$ docker context ls
NAME             TYPE  DESCRIPTION                              DOCKER ENDPOINT           KUBERNETES ENDPOINT    ORCHESTRATOR
default          moby  Current DOCKER_HOST based configuration  unix:///var/run/docker.sock                       swarm
desktop-linux *  moby                                           unix:///home/ann/.docker/desktop/docker.sock

When you have both the Docker engine and Docker Desktop installed, you can switch using the ‘docker context use’ command. For example, to switch to Docker Engine context use the following command.

$ docker context use default
default

To switch to Docker Desktop context use the following command.

$ docker context use desktop-linux
desktop-linux

Updating and Uninstalling Docker Desktop

To update Docker Desktop, One is required to download the new package and install it on top of the current version. What you have to do first is to stop any running instance and install the new version.

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

To Uninstall Docker desktop, use the following command.

sudo apt remove docker-desktop

For complete cleanup, run the following command

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

You also have to manually remove ‘credStore‘ and ‘currentContext‘ properties from the ~/.docker/config.json and any other configuration files.

Uninstalling Docker damages containers and images and other container files local to the machine. Check on Backup and Restore to do so before uninstalling it.

Conclusion

We have gone through the basics of Docker, Docker Desktop, and Docker Engine. We have also installed Docker Desktop on KDE Neon|Kubuntu systems and run a sample container. We have also seen the difference and how to switch between Docker Desktop and Docker Engine. We have gone through the features of Docker Desktop and seen how they can be enabled.

LEAVE A REPLY

Please enter your comment!
Please enter your name here