Get Docker on Ubuntu
Setting up Docker via APT Package Manager
When installing Docker Engine on a fresh Ubuntu system, you'll first need to configure the Docker APT repository. Once configured, you can easily install and maintain Docker through your system's package manager.
1. Configure the Docker APT repository
# First, update your package index and install prerequisites:
sudo apt-get update
sudo apt-get install ca-certificates curl
# Create a directory for Docker's GPG key:
sudo install -m 0755 -d /etc/apt/keyrings
# Download and save Docker's official GPG key:
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Configure the Docker repository:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# Refresh the package index to include Docker packages:
sudo apt-get update
2. Install Docker Components
Installing the Current Release
To get the most recent version of Docker, execute the following command:
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
3. Test Your Docker Installation
Confirm that Docker is working correctly by running a test container:
sudo docker run hello-world
This command will download a small test image and execute it within a container. If successful, you'll see a welcome message confirming that Docker is properly installed and operational.
Your Docker Engine installation is now complete and ready for use!