Files
Homelabbing/homelabbing/docs/knowhow/docker/index.md
2025-08-04 23:13:23 +02:00

90 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Installation
This guide explains how to install Docker Engine using the official Docker repository.
## Prerequisites
- Root or `sudo` privileges
- Supported OS: Debian 10/11/12 or Ubuntu 20.04/22.04
---
## 1. Remove old versions (if any)
```bash
sudo apt-get remove docker docker-engine docker.io containerd runc
```
---
## 2. Set up the repository
### 2.1 Install required packages
```bash
sudo apt-get update
sudo apt-get install -y \
ca-certificates \
curl \
gnupg \
lsb-release
```
### 2.2 Add Dockers official GPG key
```bash
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/$(. /etc/os-release && echo "$ID")/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
```
### 2.3 Set up the Docker repository
```bash
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \
https://download.docker.com/linux/$(. /etc/os-release && echo \"$ID\") \
$(lsb_release -cs) stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
```
---
## 3. Install Docker Engine
```bash
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
```
---
## 4. Enable and start the Docker service
```bash
sudo systemctl enable docker
sudo systemctl start docker
```
---
## 5. Verify installation
```bash
sudo docker run hello-world
```
---
## Optional: Add your user to the `docker` group
```bash
sudo usermod -aG docker $USER
newgrp docker
```
---
## References
- https://docs.docker.com/engine/install/