Photo by Rubaitul Azad on Unsplash
How to install Docker on Deepin OS 20.7 or any other Debian-based Linux distribution via the terminal emulator?
Table of contents
Revisited and updated on November 04th, 2023.
Docker
Docker is a platform for developing, shipping, and running applications in containers.
Containers are lightweight, portable, and self-sufficient units that can package an application and its dependencies, including libraries and configuration files, into a single, consistent environment.
This allows developers to create, deploy, and manage applications more efficiently, regardless of the underlying infrastructure.
Let's get down to business
shall we?
Check your OS (optional)
This step is just to make sure you have Deepin Linux installed.
lsb_release -a
hostnamectl
cat /etc/os-release
uname -a
Output
Update packages info
sudo apt-get update
Running sudo apt-get update
is an important step before installing or upgrading packages on your system because it ensures that you have the most up-to-date information about available packages.
Without updating the package index, you might not see the latest versions of software or be able to install new packages that have been added to the repositories since the last update.
Install dependencies
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
or
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
In summary, the provided command is used to install essential packages and utilities that are commonly required for adding external repositories, securely fetching packages over HTTPS, and managing software sources on an Ubuntu system. These packages are often necessary for setting up and maintaining software on your system.
Download Docker GPG (GNU Privacy Guard) key
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
Output
Check Docker GPG key
The sudo apt-key fingerprint command is used to display the fingerprint of a GPG key that has been added to the APT (Advanced Package Tool) keyring on a Debian-based Linux system. The fingerprint is a unique identifier for a GPG key, and it's used to verify the authenticity of the key.
The output would be something like the following:
0EBFCD88
is the key ID or key fingerprint of the GPG key for which you want to retrieve information. In this case, 0EBFCD88
is typically the GPG key associated with the Docker repository.
The sudo apt-key fingerprint
command is used to display the fingerprint of a GPG key that has been added to the APT (Advanced Package Tool) keyring on a Debian-based Linux system. The fingerprint is a unique identifier for a GPG key, and it's used to verify the authenticity of the key.
Docker repository for GPG key
printf 'deb [arch=amd64] https://download.docker.com/linux/debian buster stable\n'| sudo tee /etc/apt/sources.list.d/docker-ce.list
Output would be something like the following:
The command constructs a repository source entry for Docker, based on your distribution's codename (obtained using lsb_release -cs), and then writes that entry to the /etc/apt/sources.list.d/docker.list file.
This is how you add a Docker repository source to your APT configuration on a Debian-based system, ensuring that APT can find and install Docker packages from the specified repository.
Update package info
sudo apt-get update
Install docker
sudo apt-get install docker-ce docker-ce-cli containerd.io
Output
docker-ce
is the package name for Docker CE (Community Edition), which is the version of Docker designed for community use and development environments.
Docker CE Command Line Interface (CLI) is available through the package docker-ce-cli
. It provides the command-line tools for working with Docker containers and images.
containerd.io
is the package name for containerd
, which is an essential component of the Docker runtime that manages containers and provides a basic infrastructure for container execution.
Check installation
Through version
docker --version
Output
Through executable path
which docker
Output
Check status
sudo systemctl status docker
Output
Download docker compose
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
Output
Done
Celebrate
You've made it!
Let's become friends
Final thoughts
I hope this article has been helpful to you. Please feel free to reach out if you have any questions. Your thoughts, suggestions, and corrections are more than welcome.
By the way, don't hesitate to drop your suggestions for new blog articles.
I look forward to seeing you next time.