# Installing Docker — What It Is, How It Works, and Why We Use It

Before installing Docker, it’s helpful to understand **what Docker does**, **how it fits into our media management setup
**, and **why we run only the ARR stack inside Docker** while keeping **qBittorrent and Plex on the host system**.

This page breaks it down simply and practically.

---

## 🐳 What Is Docker?

Docker is a **containerization platform**.

It allows you to run applications in isolated environments called **containers**. Each container:

- Has its own filesystem
- Includes its own dependencies and libraries
- Runs separately from your main system
- Can be recreated or removed easily

Think of a container as:

> **A lightweight, specialized mini-computer dedicated to one app.**

This approach makes apps more predictable, easier to manage, and simpler to update.

---

## 🔧 Why Use Docker?

- **Avoid dependency conflicts:** Containers bundle the app’s needed libraries, leaving your base OS clean.
- **Easy updates:** Updating Radarr/Sonarr/Prowlarr is as simple as running:

```
docker compose pull
docker compose up -d
```

- **Easy backups:** Configuration files are stored in small, manageable folders.
- **Great for frequently changing apps:** Apps like Prowlarr and Radarr update often, and Docker simplifies rollout.

---

## 🚫 Why Not Put Everything in Docker?

While you could put all components into Docker, some behave poorly or have limitations when containerized, especially on
Raspberry Pi or home servers.

---

## ❌ Why qBittorrent Is NOT in Docker

qBittorrent requires:

- Precise file permission control
- Direct disk access
- Stable, predictable file paths
- High-speed I/O for torrent hashing
- Ability to handle sudden restarts and disk changes

Within Docker, qBittorrent faces problems like:

| Problem            | Cause                                     |
|--------------------|-------------------------------------------|
| Slow hashing       | Docker overlay filesystem overhead        |
| Permission issues  | UID/GID mismatch with bind mounts         |
| Inconsistent paths | Container paths differ from host paths    |
| Poor integration   | Radarr/Sonarr struggles with Docker paths |

**Conclusion:**

- Running qBittorrent directly on the host is faster, more reliable, and simpler.

---

## ❌ Why Plex Is NOT in Docker

Plex relies on:

| Feature                                     | Issue in Docker                          |
|---------------------------------------------|------------------------------------------|
| Hardware transcoding (VAAPI/V4L2/QuickSync) | Often broken or complicated to configure |
| Direct I/O from huge libraries              | Overlay filesystem slows down I/O        |
| Network discovery (multicast/IGMP)          | Blocked or isolated inside containers    |
| Handling millions of metadata files         | Poor container filesystem performance    |

**Conclusion:**

- Plex runs best on the host machine for speed, compatibility, and stable transcoding.

---

## 🟩 Why the ARR Stack *Is* in Docker

Radarr, Sonarr, Prowlarr, and Bazarr are:

- Lightweight and simple
- Use stable, clean directory structures
- Store config in small folders
- Benefit from frequent updates
- Don’t require hardware passes
- Designed to run smoothly in containers

### Benefits:

- Consistent file paths as long as `/mnt/omnissiah-vault` is mounted
- Easy migration with just config copy and docker-compose run
- Isolation protects other apps if something breaks

---

## 🧱 Summary — The Architecture Philosophy

| Component                                    | Location | Reason                                             |
|----------------------------------------------|----------|----------------------------------------------------|
| Docker Engine                                | Host     | Foundation layer                                   |
| ARR Stack (Radarr, Sonarr, Prowlarr, Bazarr) | Docker   | Perfect container candidates                       |
| qBittorrent                                  | Host     | Needs real filesystem and speed                    |
| Plex                                         | Host     | Needs hardware transcoding and network integration |

This hybrid setup balances performance, reliability, and ease of maintenance.

---

## 🧰 Installing Docker (Raspberry Pi / Linux)

This tutorial uses an installation script that:

- Updates your system
- Removes any old conflicting packages
- Installs Docker using the official convenience script
- Installs Docker Compose
- Adds your user to the docker group
- Enables and starts Docker service
- Verifies successful install

### 📥 Download Script

👉 **[install-docker.sh](../scripts/shell/install-docker.sh)**

---

## 🚀 After Installation

- reboot your system:

```bash
sudo reboot
```

Once rebooted, your system will be ready to run containerized ARR services.

---

## ➡️ Next Step: Install Plex on the Host

Once Docker is installed, move on to installing Plex directly on the host to ensure your server is ready to stream media
as the ARR stack populates your libraries.

Go to 👉 [Install Plex](install-plex.md)

---
