Some of the links shared in this post are affiliate links. If you click on the link and make a purchase, we will receive an affiliate commission at no additional cost to you.
To get started with the Docker Engine under Ubuntu, you must ensure that the minimum requirements are met.
Prerequisites
Memory: 512MB RAM (2GB recommended)
Hard disk: Sufficient to run the desired Docker containers.
CPU: Depends on the applications that are to be executed in the containers.
Operating system requirements
To install the Docker Engine, the 64-bit version of one of these Ubuntu versions is required:
- Ubuntu Hirsute 21.04
- Ubuntu Groovy 20.10
- Ubuntu Focal 20.04 (LTS)
- Ubuntu Bionic 18.04 (LTS)
Docker Engine is supported on the x86_64 (or amd64), armhf, arm64 and s390x architectures.
Supported storage drivers
The Docker Engine under Ubuntu supports the storage drivers overlay2, aufs and btrfs. The Docker Engine uses the overlay2 file system by default; if a different file system is required, this must be configured.
Uninstalling old versions
Older versions of Docker were called docker, docker.io or docker-engine. These should be uninstalled:
sudo apt-get remove docker docker-engine docker.io containerd runc
If Docker was not yet installed on the device, apt-get reports that none of these packages are installed.
Installation via the repository
Before the Docker Engine can be installed on a new host computer for the first time, the Docker repository must be set up. Docker can then be installed and updated via the repository.
Setting up the repository
Update the APT package index and install the packages required for the HTTPS repository:
sudo apt-get update
sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ gnupg \ lsb-release
Add the official GPG key from Docker:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
The following command is used to set up the Docker repository:
echo \ "deb [arch=amd64 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
Install Docker Engine
First the package index must be updated, then Docker is installed:
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
Install Docker-Compose
On Linux, the Docker Compose binaries can be downloaded from the Compose repository releases page using Curl. To install a different or newer Docker Compose version, the version information in the link (1.29.2) must be replaced with the corresponding version:
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
The execution authorizations must then be set:
sudo chmod +x /usr/local/bin/docker-compose
And the installation can be tested with the following command:
docker-compose --version