Plex Logo

Plex transcoding with Docker – NVIDIA GPU



To use Plex transcoding with Docker we need to passtrough the NVIDIA GPU to the Docker container. Plex has the ability to fully use the NVIDIA GPU for video transcoding like a bare metal install. In this post I will explain the needed steps to get Plex transcoding to work. In this example we will use Ubuntu 22.04


Updates the post with the latest NVIDIA container install commands and drivers version 535.

Nvidia driver

First we need to install the NVIDIA driver. On Ubuntu 22.04 we can install the drivers from apt. As this is a server without a GUI we will go for the headless drivers. After installing the NVIDIA driver we also need to install the package libnvidia-encode for the video transcoding.

# Search apt for NVIDIA drivers.
sudo apt search nvidia-driver
# At the time of writing the latest driver is 535.

# Install the headless drivers.
sudo apt install nvidia-headless-driver-535

# Search apt for libnvidia-encode.
sudo apt search nvidia-encode

# Install the libnvidia-encode package.
sudo apt install libnvidia-encode-535

# Install nvidia-utils package for nvidia-smi command.
sudo apt install nvidia-utils-535

After installing all the packages reboot your server and check if everything works correctly with the nvidia-smi command.


# Output
| NVIDIA-SMI 510.73.05    Driver Version: 510.73.05    CUDA Version: 11.6     |
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|   0  Quadro P2000        Off  | 00000000:0B:00.0 Off |                  N/A |
| 44%   31C    P8     5W /  75W |      2MiB /  5120MiB |      0%      Default |
|                               |                      |                  N/A |
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|  No running processes found                                                 |

NVIDIA container toolkit

After installing the drivers we need to install the NVIDIA container toolkit. More information about the NVIDIA container toolkit can be found on the NVIDIA docs site.

Setting up the package repository

curl -fsSL | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
  && curl -s -L | \
    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"
    container_name: plex
    network_mode: host
            - capabilities: [gpu]
      - PUID=1001
      - PGID=1001
      - VERSION=docker
      - NVIDIA_DRIVER_CAPABILITIES=compute,video,utility
      - /home/tizu/plex/appdata/config:/config
      - /mnt/media/TV Shows:/tv
      - /mnt/media/Movies:/movies
      - /mnt/media/Music:/music
    restart: unless-stopped

Next spin up the Docker stack and test the transcoding. In Plex you need to make sure it says Transcode (hw) when transcoding a video. For example:

Transcode (hw)


It took me quite a while to get this setup working correctly. The most important thing I was missing was the libnvidia-encode package. I hope this post helps you out getting the NVIDIA transcoding working in Plex. If you have any questions leave them in the comments!


  1. Hello,

    I am attempting to install the drivers, also on Ubuntu 22.04.
    I don’t see any “headless” offerings in the search results.

  2. Hi! I followed the tutorial and everything worked well until i can’t see the “Transcode (hw)” part.
    nvidia-smi shows my NVIDIA GPU without no problem.

    I entered in PLEX support webpage and says that function can only be enabled with plex-pass.

  3. I’ve followed a few too many guides, but this one worked for me. Appreciate the detailed write up, this was quick and got hw transcodes working!

  4. Thanks so much for this! I finally got this working after trying a bunch of times over the course of a year. Now, to see if this actually helps concurrent streams transcoding…

  5. Tried this the other night and it didn’t work for me got nvidia-smi output and the test cuda image did what it was support to do with nvidia-smi output but my plex docker will not spin up when enabling the gpu option.

    Any suggestions on how to troubleshoot this issue “Cannot read properties of null (reading ‘push’)” in portainer after adding env and turning on GPU

  6. For anyone else scratching their head, not running docker compose, but instead docker run (following the official plex docker guide), add the –gpus all flag at the end of the run command (as shown in the cuda test).

Leave a Reply

Your email address will not be published. Required fields are marked *