Docker is a set of platform as a service (PaaS) products that use OS-level virtualization to deliver software in packages called containers.
A container is software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another. A Docker container image is a lightweight, standalone, secure, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries, and settings.
The software that hosts the containers is called Docker Engine.
Let’s go through you the steps to install Docker Engine. We’re using the 64-bit version of Ubuntu Impish 21.10. If you encounter problems with older releases, please share in the Comments box below.
1. Uninstall old versions
At the shell type the command:
$ sudo apt-get remove docker docker-engine docker.io containerd runc
2. Update your system
Enter the command:
$ sudo apt update && sudo apt upgrade
3. Install dependencies
We’ll use apt again to perform this step:
$ sudo apt install apt-transport-https curl
Depending on the version of Ubuntu you’re running you may also need to install ca-certificates and software-properties-common but these packages are already present on Ubuntu 21.10.
4. Add Docker’s GPG key
Add the GPG key for the official Docker repository to your system:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
5. Add the Docker repository to APT sources
$ 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
6. Update the package database
Update the package database with the Docker packages from the added repository
$ sudo apt update
7. Check we are installing from the Docker repository
Make sure you install from the Docker repository instead of the default Ubuntu repo:
$ apt-cache policy docker-ce
Here’s the output of the command.
sde@ganges:~$ apt-cache policy docker-ce docker-ce: Installed: (none) Candidate: 5:20.10.10~3-0~ubuntu-impish Version table: 5:20.10.10~3-0~ubuntu-impish 500 500 https://download.docker.com/linux/ubuntu impish/stable amd64 Packages
8. Install Docker Engine
Install the latest version of Docker Engine with the command:
$ sudo apt install docker-ce
As the output shows, containerd.io, docker-ce-cli and other packages will also be installed.
sde@ganges:~$ sudo apt install docker-ce Reading package lists... Done Building dependency tree... Done Reading state information... Done The following additional packages will be installed: containerd.io docker-ce-cli docker-ce-rootless-extras docker-scan-plugin git git-man liberror-perl libslirp0 pigz slirp4netns Suggested packages: aufs-tools cgroupfs-mount | cgroup-lite git-daemon-run | git-daemon-sysvinit git-doc git-email git-gui gitk gitweb git-cvs git-mediawiki git-svn The following NEW packages will be installed containerd.io docker-ce docker-ce-cli docker-ce-rootless-extras docker-scan-plugin git git-man liberror-perl libslirp0 pigz slirp4netns 0 to upgrade, 11 to newly install, 0 to remove and 0 not to upgrade. Need to get 99.3 MB of archives. After this operation, 423 MB of additional disk space will be used. Do you want to continue? [Y/n]
Docker should now be installed, the daemon started, and the process enabled to start on boot.
Articles in this series:
|Getting Started with Docker|
|Installing Docker Engine||Let's start with the basics. We install Docker Engine on Ubuntu|
|Run Docker without sudo||Run Docker without the security privileges of root|
|Commands||A brief overview of the 40 Docker commands|
|Images||A Docker image is a file used to execute code in a Docker container|
|Portainer CE||Install this interface to manage different Docker environments|
|Dry||Interactive CLI for Docker containers|