To get started with the Docker engine on Ubuntu, make sure you meet the prerequisites and then install Docker.
Requirements
- Memory: 512MB RAM (2GB recommended).
- Hard disk: Sufficient to run the Docker containers you want.
- CPU: Depending on the applications you want to run in the containers.
Operating system requirements
To install Docker Engine, you need the 64-bit version of one of these Ubuntu versions:
- Ubuntu Hirsute 21.04
- Ubuntu Groovy 20.10
- Ubuntu Focal 20.04 (LTS)
- Ubuntu Bionic 18.04 (LTS)
Docker Engine is supported on x86_64 (or amd64), armhf, arm64 and s390x architectures.
Supported storage drivers
Docker Engine on Ubuntu supports the overlay2, aufs, and btrfs storage drivers.
Docker Engine uses the overlay2 storage driver by default. If you want to use aufs instead, you must configure it manually.
Uninstall 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
It is fine if apt-get reports that none of these packages are installed.
Installation via the repository
Before you install Docker Engine for the first time on a new host machine, you must set up the Docker repository. After that, you can install and upgrade Docker using the repository.
Setting up the repository
- Update the apt package index and install packages so that apt can use a repository over HTTPS:
sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg \
lsb-release
2. Fügen Sie den offiziellen GPG-Schlüssel von Docker hinzu:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg – dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
3. Use the following command to set up the stable 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
- Update the apt package index and install the latest version of Docker Engine and containerd, or go to the next step to install a specific version:
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
Install Docker Compose
On Linux, you can download the Docker Compose binaries from the Compose repository releases page on GitHub. Follow the instructions at the link. To do this, you will need to run the curl command in your terminal to download the binaries. You can also find these step-by-step instructions below.
- Run this command to download the latest stable version of Docker Compose:
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
If you want to install a different version of Compose, replace 1.29.2 with the version of Compose you want to use.
2. Apply execute permissions to the binary:
sudo chmod +x /usr/local/bin/docker-compose
3. Test the installation
docker-compose – version