Install and Use Docker Desktop on Debian 12/11/10

Suppose you are looking for the fastest way to containerize your applications, look no further. Docker Desktop is an application for building and sharing containerized applications and microservices. Docker Desktop is available in macOS, Windows, and Linux. Docker Desktop has Docker Engine, Docker CLI client, Docker Compose, Docker content trust, K8S, and credential helper all bundled together.

Containerization is the packaging of software code with all its libraries and dependencies required to run the code to create a single lightweight executable called a container. This has a huge impact on developers because it eliminates the complexity associated with building complex environments for application building. The approach is also easy to use and accelerates productivity. In addition, containerization helps the developers to create and deploy applications faster and more securely. Developers are able to bundle application code together with its associated configuration files, libraries, and dependencies required to run it.

Docker Desktop and Docker Engine basics

With Docker Desktop the developer can:

  • Choose his / her development tools and languages from the same bundle.
  • Choose his preferred licensed images and template from Docker Hub.
  • Extend his / her environment to rapidly auto-build, continually integrate and collaborate using a secure repository.

Docker Engine is an Open-Source containerization technology for building and deploying container applications. Docker Engine acts as the Client/Server application where:

  • The server has a daemon running in it called dockerd
  • A command-line interface (CLI) client called docker.
  • APIs to specify programs that interfaces use to communicate with docker daemon.

The CLI uses docker APIs to control the Docker daemon through scripting or through command-line interface commands. Dockerd daemon creates and manages Docker objects e.g images, containers, networks, and volumes.

Features of Docker Desktop

Let’s briefly look at the Docker Desktop features.

  • Docker Extensions to transform and optimize workflows e.g debugging, testing, networking, and security. The developer is able to develop his own customized tools and share them with teams across the globe.
  • Volume management – With Docker Desktop it is easy to see what taking up space and remove it whether files or directories. It is also easy to set up developer environments across an organization.
  • With Docker Desktop you can containerize and share any application on any cloud platform and in multiple languages.
  • Docker Desktop is very secure – you can quickly and safely evaluate software so you can start secure and push with confidence. Docker Desktop is now able to generate a Software Bill of Material (SBOM) which is pre-built and Synk for vulnerability scanning to provide actionable insights and recommendations for remediation in your images.
  • Simplify code to cloud – Simplify code to cloud application development by closely integrating with Azure Container Instances (ACI). No infrastructure to manage. No clusters to provision.
  • Image Access Management – The developer is able to manage which container image on Docker Hub he can access and gain more control over. The developer will have access to Docker Official Images and Docker Verified Publishers.
  • Includes the latest version of Kubernetes – Build Kubernetes-ready applications on your desktop.
  • Automatic updates to keep you up to date and secure
  • On Windows, the ability to toggle between Linux and Windows Server environments to build applications
  • Fast and reliable performance with native Windows Hyper-V virtualization
  • Ability to work natively on Linux through WSL 2 on Windows machines

See more features on the official Docker Desktop website.

Install and Use Docker Desktop on Debian 12/11/10

To perform the Installation of Docker Desktop on Debian your system should meet certain requirements:

Ensure the following requirements are met:

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

We will begin the process. Restore a snapshot to ensure a clean system.

Step 1. Update your Debian system

Run the command.

sudo apt update -y && sudo apt upgrade -y

Docker Desktop runs a VM that requires KVM support. It should load automatically if the host machine has virtualization support. To manually load the KVM on your system, run the command.

sudo modprobe kvm

Depending on the processor of the host machine, the corresponding module must be loaded:

sudo modprobe kvm_intel  # intel processors
sudo modprob kvm_amd # amd processors

Check if KVM Modules are enabled in your system.

$ lsmod | grep kvm
kvm_intel             327680  0
kvm                   921600  1 kvm_intel
irqbypass              16384  1 kvm

Set up KVM device user permissions.

Check who owns the /dev/kvm

$ ls -al /dev/kvm 
crw-rw----+ 1 root kvm 10, 232 Apr  8 06:11 /dev/kvm

Add your user to the KVM group so as to access the KVM device:

sudo usermod -aG kvm $USER

Reboot your server.

sudo reboot 

Step 2. Install Docker Desktop on Debian

After confirming that all the steps above are met, it’s time to install Docker Desktop in your system.

Begin by uninstalling the previous Docker Desktop versions.

sudo apt remove docker-desktop

It is okay if you didn’t have any installed versions of docker-desktop.

To completely purge the data files associated with docker-desktop, run the commands below.

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

If you are running on a Gnome Desktop environment, install AppIndicator and KStatusNotifierItem Gnome EXtensions. For non-Gnome Desktop environments, install gnome-terminal.

sudo apt install gnome-terminal

If you get (gnome-terminal is already the newest version (3.xx.x-x)) should be okay. We are now set to continue.

Set Docker package repository.

1) Update the APT Index.

sudo apt update -y

Install packages to allow APT to use repo over HTTPS.

sudo apt install ca-certificates curl gnupg software-properties-common lsb-release  -y

2) Add Docker’s official GPG key.

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

3) Set up a stable repository.

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

4) Update the package database.

sudo apt update 

5) Install Docker Engine

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

6) Add your user to docker group

sudo usermod -aG docker $USER
newgrp docker

Install Docker Desktop on Debian

Visit the official Docker Desktop site and download the latest release. As of this writing, the latest release is Docker Desktop 4..x.

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

Install Docker Desktop by this command:

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

The command installs all the required binary packages and any dependencies for Docker Desktop.

Post-install script

The installation above does the following for you.

  • 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 link from /usr/bin/docker to /usr/local/bin/com.docker.cli
$ sudo vim /etc/hosts
127.0.0.1       localhost
127.0.1.1       debian12

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
# Added by Docker Desktop
# To allow the same kube context to work on the host and the container:
127.0.0.1       kubernetes.docker.internal
# End of section

Will confirm the above.

Step 3. Launch Docker Desktop

To launch Docker Desktop, search Docker Desktop on the Applications menu. Double click on the icon to open Docker Desktop.

Alternatively, you can launch the Docker Desktop on the CLI by this command.

systemctl --user start docker-desktop

The command opens the welcome page as below.

Accept the terms of use by ticking the checkbox and clicking Accept to proceed.

When you start Docker Desktop, a dedicated context that Docker CLI uses as the target is created that sets this context as the current context in use. This avoids a clash with Docker Engine that might be running in your system. Once you shut down the Docker Desktop, the current context is set back to the previous one.

Installation of Docker Desktop installs Docker Compose V2 which can be linked as docker-compose from the Settings panel. Also, Docker CLI binaries are installed on the host.

Step 4. Post Docker Desktop Installation checks

After a successful installation, you can confirm the versions of the binary files installed.

Check the Docker Compose version.

$ docker compose version
Docker Compose version v2.29.7-desktop.1

Check the Docker version.

$ docker --version
Docker version 27.3.1, build ce12230

To view more information about Docker.

$ docker version
Client: Docker Engine - Community
 Version:           27.3.1
 API version:       1.47
 Go version:        go1.22.7
 Git commit:        ce12230
 Built:             Fri Sep 20 11:41:11 2024
 OS/Arch:           linux/amd64
 Context:           desktop-linux

Server: Docker Desktop 4.35.1 (173168)
 Engine:
  Version:          27.3.1
  API version:      1.47 (minimum version 1.24)
  Go version:       go1.22.7
  Git commit:       41ca978
  Built:            Fri Sep 20 11:41:11 2024
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.7.21
  GitCommit:        472731909fa34bd7bc9c087e4c27943f9835f111
 runc:
  Version:          1.1.13
  GitCommit:        v1.1.13-0-g58aa920
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Enable and Start Docker Desktop to start on boot.

systemctl --user enable docker-desktop
systemctl --user start docker-desktop

To confirm the status of the Docker Desktop.

$ systemctl --user status docker-desktop
● docker-desktop.service - Docker Desktop
     Loaded: loaded (/usr/lib/systemd/user/docker-desktop.service; disabled; preset: enabled)
     Active: active (running) since Wed 2024-11-06 23:32:38 EAT; 15min ago
   Main PID: 4783 (com.docker.back)
      Tasks: 114 (limit: 4622)
     Memory: 1.4G
        CPU: 42.636s
     CGroup: /user.slice/user-1000.slice/[email protected]/app.slice/docker-desktop.service
             ├─4783 /opt/docker-desktop/bin/com.docker.backend
             ├─4798 /opt/docker-desktop/bin/com.docker.backend run
             ├─4809 "/opt/docker-desktop/Docker Desktop --analytics-enabled=true --name=new-license"
             ├─4810 com.docker.dev-envs -watchdog
             ├─4811 com.docker.build
             ├─4824 "/opt/docker-desktop/Docker Desktop --type=zygote --no-zygote-sandbox"
             ├─4825 "/opt/docker-desktop/Docker Desktop --type=zygote"
             ├─4830 "/opt/docker-desktop/Docker Desktop --type=zygote"
             ├─4884 "/opt/docker-desktop/Docker Desktop --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=n>
             ├─4945 "/opt/docker-desktop/Docker Desktop --type=gpu-process --enable-crash-reporter=59f0e2ca-1222-4083-b3e1-03603935281e,no_channel --user-da>
             ├─5281 /opt/docker-desktop/bin/virtiofsd --socket-path=/home/cloudspinx/.docker/desktop/virtiofs.sock0 -o cache=auto --shared-dir=/home --sandb>
             ├─5290 qemu-system-x86_64 -accel kvm -cpu host -machine q35 -m 1024 -smp 2 -kernel /opt/docker-desktop/linuxkit/kernel -append "init=/init logl>
             └─5352 "/opt/docker-desktop/Docker Desktop --type=renderer --enable-crash-reporter=59f0e2ca-1222-4083-b3e1-03603935281e,no_channel --user-data->

To stop Docker Desktop.

systemctl --user stop docker-desktop

Upgrading Docker Desktop

Once a new version of Docker Desktop is released, you can easily upgrade to the latest release by the command:

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

Where <version> is the latest version release and <arch is the system architecture.

Step 5. Manage Docker as a non-root user

You might choose to manage Docker as a non-root user so that you don’t use the sudo command. This is because the Docker Daemon always runs as the root user. This can be achieved by creating a Unix Docker group and adding users to this group. When you start the Docker daemon, it creates a Unix socket accessible by members of the Docker group.

1 ) Create a Docker group.

sudo groupadd docker

This should already be created for you.

2 ) Add users to the docker group.

sudo usermod -aG docker $USER

3 ) Activate group changes.

newgrp docker 

4 ) Verify you can run commands without sudo.

$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete 
Digest: sha256:80f31da1ac7b312ba29d65080fddf797dd76acfb870e677f390d5acba9741b17
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

To uninstall Docker Desktop, simply execute the command:

sudo apt remove docker-desktop

For a complete cleanup or purge, run the commands.

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

Conclusion

In this guide, we have learned how to Install and Use Docker Desktop on Debian 11 / Debian 10. I do hope the guide has helped you. If you don’t mind, please leave a comment below. For more highlights, please visit the official Docker Desktop Document.

Explore More with CloudSpinx

Looking to streamline your tech stack? At CloudSpinx, we deliver robust solutions tailored to your needs. Pleas visit our official page for inquiries.

Your IT Journey Starts Here!

Ready to level up your IT skills? Our new eLearning platform is coming soon to help you master the latest technologies.

Be the first to know when we launch! Join our waitlist now.

Join our Linux and open source community. Subscribe to our newsletter for tips, tricks, and collaboration opportunities!

Recent Post

Leave a Comment

Your email address will not be published. Required fields are marked *

Related Post

k0s is an open-source single binary Kubernetes distribution for building Kubernetes clusters that has zero dependence on the host OS. […]

Basic backup and restoration of k0s were delivered back in April 2021. There has been continued development and now k0s […]

Kubernetes is a container orchestration, runtime platform for creating cloud-native applications. It was developed by Google and it is currently […]

Let's Connect

Unleash the full potential of your business with CloudSpinx. Our expert solutions specialists are standing by to answer your questions and tailor a plan that perfectly aligns with your unique needs.
You will get a response from our solutions specialist within 12 hours
We understand emergencies can be stressful. For immediate assistance, chat with us now

Contact CloudSpinx today!

Download CloudSpinx Profile

Discover the full spectrum of our expertise and services by downloading our detailed Company Profile. Simply enter your first name, last name, and email address.