Skip to main content

Install Docker

TriviaFlow runs entirely inside Docker containers. This architecture ensures that the application behaves exactly the same on your server as it does in our development environment, regardless of the underlying Linux distribution.

You need two components:

  1. Docker Engine: The core runtime that runs the containers.
  2. Docker Compose (V2): The tool that orchestrates the multi-container setup (Database, App, Webserver).

The official Docker convenience script is the fastest way to get everything up and running on a fresh server. It detects your operating system and installs the correct stable versions automatically.

Recommended for Most Users

This method is officially supported by Docker and is perfect for getting started quickly without dealing with GPG keys and repositories manually.

Run the following command:

curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh

Once the script finishes, you can skip straight to the Post-Installation Steps.


Option B: The "Manual" Way (Production)

If you prefer full control over your package sources (e.g., for strict production environments), use the standard repository installation.

1. Set up the repository:

# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
sudo install -m 0755 -d /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
sudo chmod a+r /etc/apt/keyrings/docker.gpg

# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \
$(. /etc/os-release; echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

2. Install Docker packages:

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Post-Installation Steps

Regardless of which installation method you chose, you should perform these final configuration steps.

1. Enable Docker Service

Ensure Docker starts automatically if your server reboots.

sudo systemctl enable --now docker

2. Manage Docker as Non-Root (Optional)

By default, you need sudo to run docker commands. To avoid typing sudo every time, add your current user to the docker group.

sudo usermod -aG docker $USER
Log out required

After running this command, you must log out and log back in (or close your SSH session and reconnect) for the group changes to take effect.

3. Verify Installation

Check if both Docker and Docker Compose are installed correctly.

# Check Docker version
docker --version
# Output example: Docker version 24.0.5, build ced0996

# Check Compose version (Must be v2.x.x)
docker compose version
# Output example: Docker Compose version v2.20.2
Do not use docker-compose

Older tutorials might reference docker-compose (with a hyphen). This is the obsolete Python v1 version. TriviaFlow requires the modern Docker Compose v2 plugin, which is used as docker compose (with a space).

📥 Clone the Project

Now that your server is ready, let's download the TriviaFlow source code.

git clone https://github.com/YOUR-USERNAME/triviaflow.git

Next Step: Let's configure the environment variables!