Docker Installation
Docker Installation
Docker Installation
Introduction
- Setup Docker on Ubuntu
Prerequisites
- List required tools (e.g., kubectl, kind, minikube, k3d, or a cloud provider like AKS, EKS, GKE).
- Mention OS compatibility and system requirements.
Install Docker on Ubuntu
- Setup Docker’s apt repository
1
2
3
4
5
6
7
8
9
10
11
12
sudo apt-get update
sudo apt-get install ca-certificates curl -y
sudo install -m 0755 -d /etc/apt/keyrings
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
# Add the repository to Apt sources:
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
sudo apt-get update
- Install the Docker Packages
1
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y
- Verify the installation
1
sudo docker run hello-world
Cleanup
- Uninstall the Docker Engine CLI, containerd and Docker Compose packages
1
sudo apt-get purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras
- Remove Images, containers, volumes, or custom configuration files on your host aren’t automatically removed.
1
2
sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd
- Remove source list and keyrings
1
2
sudo rm /etc/apt/sources.list.d/docker.list
sudo rm /etc/apt/keyrings/docker.asc
Conclusion
- We install Docker using the apt repository and verified the installation.
- We cleaned up the docker installation.
This post is licensed under CC BY 4.0 by the author.