📦 Installing Docker
Installing Docker on Ubuntu
Installing Docker on Ubuntu is as simple as installing any other software:
bash
# 1. Update package index
sudo apt update
# 2. Install dependencies
sudo apt install -y ca-certificates curl gnupg
# 3. Add Docker's official GPG key
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
# 4. Add Docker repository
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \
https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# 5. Install Docker
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin💡 Tip: 💡 Note:
docker-compose-pluginis the built-in Compose plugin included with newer versions of Docker. You don't need to installdocker-composeseparately.
Installing Docker on CentOS
bash
# 1. Install dependencies
sudo yum install -y yum-utils
# 2. Add Docker repository
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
# 3. Install Docker
sudo yum install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
# 4. Start Docker
sudo systemctl start docker
sudo systemctl enable dockerWindows / macOS Installation
Windows and macOS users should download Docker Desktop:
- Windows: Download Docker Desktop for Windows — WSL2 is required
- macOS: Download Docker Desktop for Mac — separate versions for Intel and Apple Silicon
⚠️ Note: ⚠️ Windows users: it is strongly recommended to use the WSL2 backend instead of Hyper-V for much better performance! Docker Desktop will prompt you to choose during installation.
Post-Installation Configuration
bash
# Add current user to the docker group (run without sudo)
sudo usermod -aG docker $USER
# Takes effect after re-login, or temporarily use:
newgrp docker
# Verify installation
docker --version
Docker version 24.0.7, build afdd53b
docker compose version
Docker Compose version v2.21.0
# Run a test container
docker run hello-world
Hello from Docker!
This message shows that your installation appears to be working correctly.
...