Created
June 3, 2024 23:08
-
-
Save lmarcondes/2fb2e4303769a43df85fd8ba77801f27 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/usr/env bash | |
## Source: https://tizutech.com/plex-transcoding-with-docker-nvidia-gpu/ | |
## Setting up the package repository | |
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \ | |
&& curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \ | |
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \ | |
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list | |
## Installing the NVIDIA container toolkit | |
# Update apt. | |
sudo apt-get update | |
# Install the nivida-container-toolit package. | |
sudo apt-get install -y nvidia-container-toolkit | |
# Configure the container runtime by using the nvidia-ctk command. | |
sudo nvidia-ctk runtime configure --runtime=docker | |
# Restart Docker. | |
sudo systemctl restart docker | |
# Test the GPU with a base CUDA container. | |
sudo docker run --rm --runtime=nvidia --gpus all ubuntu nvidia-smi | |
# Docker compose options | |
# | |
# After all the local packages we need to configure our Docker compose file to use the NVIDIA GPU inside the Plex container. I will assume you have the latest version of Docker installed with the new Docker compose version. Below is an example of my Docker compose file for Plex transcoding with Docker. | |
# --- | |
# version: "3.8" | |
# services: | |
# plex: | |
# image: lscr.io/linuxserver/plex:latest | |
# container_name: plex | |
# network_mode: host | |
# deploy: | |
# resources: | |
# reservations: | |
# devices: | |
# - capabilities: [gpu] | |
# environment: | |
# - PUID=1001 | |
# - PGID=1001 | |
# - VERSION=docker | |
# - PLEX_CLAIM=##CLAIM-TOKEN## | |
# - NVIDIA_VISIBLE_DEVICES=all | |
# - NVIDIA_DRIVER_CAPABILITIES=compute,video,utility | |
# volumes: | |
# - /home/tizu/plex/appdata/config:/config | |
# - /mnt/media/TV Shows:/tv | |
# - /mnt/media/Movies:/movies | |
# - /mnt/media/Music:/music | |
# restart: unless-stopped | |
# | |
# | |
# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment