Docker

Overview

ViewTube can be run in a Docker container. You will need to have Docker and Docker Compose installed.

Version overview

Latest

viewtube:latest is the latest stable version. It should generally be safe to use. If you don't want to update automatically, you can use the version tag directly. undefined

Dev

viewtube:dev is the development version, which means it may contain bugs. However, it will receive fixes faster if YouTube changes something. Docker Image Version (latest semver)

Official Setup

Environment variables

Check the configuration page for more information about the environment variables.

For the purpose of this guide, we will use the following environment variables:

VIEWTUBE_DATABASE_HOST: viewtube-mongodb
VIEWTUBE_REDIS_HOST: viewtube-redis

Docker-compose file

Create a folder for your ViewTube instance.

mkdir viewtube
cd viewtube

Inside, create a file named docker-compose.yml with the following contents:

version: '3'

services:
  viewtube:
    restart: unless-stopped
    # Or use mauriceo/viewtube:dev for the development version
    image: mauriceo/viewtube:latest
    # ViewTube will not start until the database and redis are ready
    depends_on:
      - viewtube-mongodb
      - viewtube-redis
    # Make sure all services are in the same network
    networks:
      - viewtube
    volumes:
      # This will map ViewTube's data directory to the local folder ./data/viewtube/
      - ./data/viewtube:/data
    environment:
      - VIEWTUBE_DATABASE_HOST=viewtube-mongodb
      - VIEWTUBE_REDIS_HOST=viewtube-redis
    ports:
      - 8066:8066

  viewtube-mongodb:
    restart: unless-stopped
    image: mongo:7
    networks:
      - viewtube
    volumes:
      - ./data/db:/data/db

  viewtube-redis:
    restart: unless-stopped
    image: redis:7
    networks:
      - viewtube
    volumes:
      - ./data/redis:/data

networks:
  viewtube:

Running on systems without AVX support, e.g. Synology NAS

When running on a home NAS system, e.g. Synlogy, QNAP, ASUSTOR, etc., you may encounter the following warning:

viewtube-mongodb    | WARNING: MongoDB 5.0+ requires a CPU with AVX support, and your current system does not appear to have that!
viewtube-mongodb    |   see https://jira.mongodb.org/browse/SERVER-54407
viewtube-mongodb    |   see also https://www.mongodb.com/community/forums/t/mongodb-5-0-cpu-intel-g4650-compatibility/116610/2
viewtube-mongodb    |   see also https://github.com/docker-library/mongo/issues/485#issuecomment-891991814

If so you may use mongo:4.4 instead of mongo:7:

...
  viewtube-mongodb:
    restart: unless-stopped
    image: mongo:4.4
...

You may also try using a raspberry-pi specific version of MongoDB (e.g. https://github.com/isaric/mongodb-raspberrypi-docker)

All-in-one Setup (by mvanduijker)

Github user @mvanduijker made an all-in-one image of ViewTube. Check it out here: https://github.com/mvanduijker/viewtube-all-in-one