docker installation - panuozzo77/StreamingCommunity GitHub Wiki

Docker Installation

This guide explains how to set up and run the StreamingCommunity application using Docker, providing an isolated and consistent environment across different platforms.

Prerequisites

Before proceeding with the Docker installation, ensure you have:

  1. Docker: Installed and running on your system

  2. Make (optional): For using the quick setup commands in the Makefile

    • Windows: Install via Chocolatey: choco install make
    • macOS: Included with Xcode Command Line Tools
    • Linux: Install via package manager (e.g., sudo apt install make)

Installation Steps

Step 1: Get the StreamingCommunity Repository

You can either clone the repository using Git or download it as a ZIP file.

Option A: Clone with Git

git clone https://github.com/Arrowar/StreamingCommunity.git
cd StreamingCommunity

Option B: Download ZIP

  1. Go to https://github.com/Arrowar/StreamingCommunity
  2. Click the "Code" button and select "Download ZIP"
  3. Extract the ZIP file to your desired location
  4. Navigate to the extracted directory

Step 2: Build the Docker Image

From the StreamingCommunity directory, build the Docker image:

docker build -t streaming-community-api .

This command builds a Docker image named streaming-community-api using the Dockerfile in the current directory. The build process may take several minutes depending on your internet connection and system performance.

Running StreamingCommunity in Docker

Basic Usage

To run StreamingCommunity in a Docker container:

docker run -it -p 8000:8000 streaming-community-api

This command:

  • -it: Runs the container in interactive mode with a pseudo-TTY
  • -p 8000:8000: Maps port 8000 from the container to port 8000 on your host
  • streaming-community-api: Uses the image we built earlier

Persisting Downloaded Content

By default, videos will be saved in /app/Video inside the container. To save them on your host machine instead:

docker run -it -p 8000:8000 -v /path/to/download:/app/Video streaming-community-api

Replace /path/to/download with the absolute path to your desired download directory on your host machine.

Quick Setup with Make

If you have make installed, you can use the commands configured in the Makefile:

# Build the container
make build-container

# Run the container with a custom download directory
make LOCAL_DIR=/path/to/download run-container

The run-container command also mounts the config.json file, so any changes to the configuration file are reflected immediately without having to rebuild the image.

Docker Compose (Advanced)

For a more persistent setup, you can use Docker Compose. Create a file named docker-compose.yml with the following content:

version: '3'
services:
  streamingcommunity:
    build: .
    ports:
      - "8000:8000"
    volumes:
      - ./config.json:/app/config.json
      - /path/to/download:/app/Video
    restart: unless-stopped

Then run:

docker-compose up -d

To stop the container:

docker-compose down

Customizing the Docker Environment

Using a Different Configuration

To use a custom configuration file:

docker run -it -p 8000:8000 -v /path/to/your/config.json:/app/config.json streaming-community-api

Accessing the Container Shell

To access the shell inside the running container:

# First, find the container ID
docker ps

# Then access the shell
docker exec -it CONTAINER_ID /bin/bash

Replace CONTAINER_ID with the actual ID of your running container.

Troubleshooting

Common Issues

  1. Permission Denied for Volumes

    • Ensure the host directory has appropriate permissions
    • On Linux, you might need to adjust SELinux settings: sudo chcon -Rt svirt_sandbox_file_t /path/to/download
  2. Port Already in Use

    • Change the host port mapping: -p 8001:8000
  3. Container Exits Immediately

    • Check logs with: docker logs CONTAINER_ID
    • Ensure the container is run with the -it flag for interactive mode
  4. Network Issues Inside Container

    • Verify your Docker network settings
    • Try using the --network host option (Linux only)

Getting Help

If you encounter issues not covered here:

Next Steps

⚠️ **GitHub.com Fallback** ⚠️