# Docker compose 1.29.0 - Hardware Transcoding

**URL:** <https://forums.plex.tv/t/docker-compose-1-29-0-hardware-transcoding/708900>\
**Category:** Plex Media Server\
**Tags:** server-docker\
**Created:** [April 12, 2021, 6:57am UTC](https://forums.plex.tv/t/docker-compose-1-29-0-hardware-transcoding/708900 "2021-04-12T06:57:29Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![D34DC3N73R](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/d34dc3n73r/32/108198_2.png) [@D34DC3N73R](https://forums.plex.tv/u/D34DC3N73R)\
**Post date:** [April 12, 2021, 6:57am UTC](https://forums.plex.tv/t/docker-compose-1-29-0-hardware-transcoding/708900/1 "2021-04-12T06:57:30Z")

</div>

Server Version#: 1.22.2.4282

I updated docker-compose to the latest version and it seems like hardware transcoding is no longer working with the new schema for adding gpus. This is with both the runc and nvidia runtimes.

```auto
version: '3.8'
services:
  plex:
    container_name: plex
    image: plexinc/pms-docker:beta
    restart: unless-stopped
    network_mode: host
    environment:
      - TZ=$TZ
      - PLEX_UID=$PUID
      - PLEX_GID=$PGID
    volumes:
      - /data/.config/plex:/config
      - /mnt/media:/media
      - /dev/shm:/transcode
    deploy:
      resources:
        reservations:
          devices:
          - driver: nvidia
            count: all
            capabilities: [gpu]

```

nvidia-smi works fine in the container

```auto
$ docker exec -it plex nvidia-smi
Sun Apr 11 21:48:36 2021       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 460.67 Driver Version: 460.67 CUDA Version: 11.2 |
|-------------------------------+----------------------+----------------------+
| 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:01:00.0 Off | N/A |
| 48% 37C P8 7W / 75W | 55MiB / 5057MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
+-----------------------------------------------------------------------------+

```

However, transcodes are now using software instead of hardware.  
 ![image](https://global.discourse-cdn.com/plex/original/3X/5/e/5e10e9762b04e7dec5258aea58a24e2301067eff.jpeg)

---

<div class="post-metadata">

**Author:** ![D34DC3N73R](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/d34dc3n73r/32/108198_2.png) [@D34DC3N73R](https://forums.plex.tv/u/D34DC3N73R)\
**Post date:** [April 12, 2021, 7:04am UTC](https://forums.plex.tv/t/docker-compose-1-29-0-hardware-transcoding/708900/2 "2021-04-12T07:04:31Z")

</div>

I see this is Plex Media Server.log

```auto
Apr 11, 2021 23:56:20.446 [0x7f10f9ffb700] DEBUG - [Transcode] Codecs: testing h264_vaapi (encoder)
Apr 11, 2021 23:56:20.446 [0x7f10f9ffb700] DEBUG - [Transcode] Codecs: hardware transcoding: testing API vaapi
Apr 11, 2021 23:56:20.446 [0x7f10f9ffb700] DEBUG - [Transcode] Codecs: hardware transcoding: opening hw device failed - probably not supported by this system, error: Generic error in an external library
Apr 11, 2021 23:56:20.446 [0x7f10f9ffb700] DEBUG - [Transcode] Codecs: testing h264_nvenc (encoder)
Apr 11, 2021 23:56:20.446 [0x7f10f9ffb700] DEBUG - [Transcode] Codecs: hardware transcoding: testing API nvenc
Apr 11, 2021 23:56:20.447 [0x7f10f9ffb700] ERROR - [Transcode] [FFMPEG] - Cannot load libcuda.so.1
Apr 11, 2021 23:56:20.447 [0x7f10f9ffb700] ERROR - [Transcode] [FFMPEG] - Could not dynamically load CUDA
Apr 11, 2021 23:56:20.447 [0x7f10f9ffb700] DEBUG - [Transcode] Codecs: hardware transcoding: opening hw device failed - probably not supported by this system, error: Unknown error occurred
Apr 11, 2021 23:56:20.447 [0x7f10f9ffb700] DEBUG - [Transcode] Codecs: testing h264 (decoder) with hwdevice vaapi
Apr 11, 2021 23:56:20.447 [0x7f10f9ffb700] DEBUG - [Transcode] Codecs: hardware transcoding: testing API vaapi
Apr 11, 2021 23:56:20.447 [0x7f10f9ffb700] DEBUG - [Transcode] Codecs: hardware transcoding: opening hw device failed - probably not supported by this system, error: Generic error in an external library
Apr 11, 2021 23:56:20.447 [0x7f10f9ffb700] DEBUG - [Transcode] Codecs: testing h264 (decoder) with hwdevice nvdec
Apr 11, 2021 23:56:20.447 [0x7f10f9ffb700] DEBUG - [Transcode] Codecs: hardware transcoding: testing API nvdec
Apr 11, 2021 23:56:20.447 [0x7f10f9ffb700] ERROR - [Transcode] [FFMPEG] - Cannot load libcuda.so.1
Apr 11, 2021 23:56:20.447 [0x7f10f9ffb700] ERROR - [Transcode] [FFMPEG] - Could not dynamically load CUDA
Apr 11, 2021 23:56:20.447 [0x7f10f9ffb700] DEBUG - [Transcode] Codecs: hardware transcoding: opening hw device failed - probably not supported by this system, error: Unknown error occurred

```

---

<div class="post-metadata">

**Author:** ![D34DC3N73R](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/d34dc3n73r/32/108198_2.png) [@D34DC3N73R](https://forums.plex.tv/u/D34DC3N73R)\
**Post date:** [April 12, 2021, 8:16am UTC](https://forums.plex.tv/t/docker-compose-1-29-0-hardware-transcoding/708900/3 "2021-04-12T08:16:41Z")

</div>

Further evidence that this is a plex specific problem is that emby has no problem making use of the GPU acceleration.

```auto
  emby:
    image: emby/embyserver:beta
    container_name: emby
    restart: unless-stopped
    ports:
      - 8096:8096
      - 8920:8920
    environment:
      - TZ=$TZ
      - UID=$PUID
      - GID=$PGID
    volumes:
      - /data/.config/emby:/config
      - /mnt/media:/media
      - /dev/shm/emby:/transcode
    deploy:
      resources:
        reservations:
          devices:
          - driver: nvidia
            count: all
            capabilities: [gpu]

```

![image](https://global.discourse-cdn.com/plex/original/3X/b/c/bcf5f151cccf518bf70df601689c593218ef9a2b.jpeg)

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [April 12, 2021, 1:11pm UTC](https://forums.plex.tv/t/docker-compose-1-29-0-hardware-transcoding/708900/4 "2021-04-12T13:11:02Z")

</div>

While I don’t have Nvidia (NUC8i7-HVK here),  
I have no difficulties with hardware transcoding in Docker containers.

It is important to note the Beignet libraries are installed in the container for proper HDR tone mapping in hardware.

```auto
sudo docker stop plex
sudo docker rm plex

sudo docker run \
-d \
--name plex \
--network=host \
-e TZ="EST" \
-e LANG="en_US.UTF-8" \
-e ADVERTISE_IP="http://<hostIPAddress>:32400/" \
-e PLEX_UID=1001 \
-e PLEX_GID=1001 \
-e PUID=1001 \
-e PGID=1001 \
-h dockerplex \
-v /dockerplex:/config \
-v /dockerplex/tmp:/tmp \
-v /dockerplex/transcode:/transcode \
-v /nas:/data \
--device=/dev/dri:/dev/dri \
plexinc/pms-docker

docker start plex
docker update --restart=unless-stopped plex

```

Does this help?

Hint: Do you have the Nvidia drivers installed in the container?

---

<div class="post-metadata">

**Author:** ![D34DC3N73R](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/d34dc3n73r/32/108198_2.png) [@D34DC3N73R](https://forums.plex.tv/u/D34DC3N73R)\
**Post date:** [April 12, 2021, 3:08pm UTC](https://forums.plex.tv/t/docker-compose-1-29-0-hardware-transcoding/708900/5 "2021-04-12T15:08:18Z")

</div>

No that doesn’t help. Since docker v19.03 you’ve been able to use the --gpus flag. Meaning gpu support was built natively into the runc runtime. It was no longer necessary to specify the nvidia runtime and use nvidia specific environment variables.  
This option has finally made it to docker compose via the new schema used above. However, it doesn’t work with plex specifically. While it works with other images like emby. Nvidia drivers (v460.67) are installed on the host system as you can see from the nvidia-smi command run directly in the plex container. As well as the latest version of nvidia container toolkit. Also, hardware transcoding works fine when using the old method of editing the default runtime in /etc/docker/daemon.json and using nvidia specific environment variables.

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [April 12, 2021, 6:02pm UTC](https://forums.plex.tv/t/docker-compose-1-29-0-hardware-transcoding/708900/6 "2021-04-12T18:02:39Z")

</div>

I just looked back through the history of the packaging.  
Nothing has changed in a long time.

That might be part of , or even the root of, the problem.

I just created a test case using both Emby and Plex.  
One thing Emby does, which Plex doesn’t do, is GPU device selection.

In light of a recent experience with ESXi and GPU passthrough, I did have to specify the specific `HardwareDevicePath="/dev/dri/renderD129"` in my case (being the second device discovered.

I don’t know if this has any applicability to how the Nvidia drivers present themselves in your desktop Linux. I did see them present themselves in `/dev/dri` and `/sys/module` on QNAP (of all things).

If you can help me identify what needs to be done, I will gladly write it up and submit it.

---

<div class="post-metadata">

**Author:** ![D34DC3N73R](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/d34dc3n73r/32/108198_2.png) [@D34DC3N73R](https://forums.plex.tv/u/D34DC3N73R)\
**Post date:** [April 12, 2021, 6:14pm UTC](https://forums.plex.tv/t/docker-compose-1-29-0-hardware-transcoding/708900/7 "2021-04-12T18:14:43Z")

</div>

Passing the GPU is a pretty different animal than exposing /dev/dri. Much of it is taken care of with the nvidia container toolkit.

It may be a problem with the plex image rather than plex itself. The linuxserver image appears to have no problem using hardware transcoding. /data/.config/plex-lsio is a direct copy of /data/.config/plex

```auto
  plex-lsio:
    container_name: plex-lsio
    image: linuxserver/plex
    restart: unless-stopped
    network_mode: host
    environment:
      - TZ=$TZ
      - PUID=$PUID
      - PGID=$PGID
    volumes:
      - /data/.config/plex-lsio:/config
      - /mnt/media:/media
      - /dev/shm:/transcode
    deploy:
      resources:
        reservations:
          devices:
          - driver: nvidia
            count: all
            capabilities: [gpu]

```

![image](https://global.discourse-cdn.com/plex/original/3X/3/5/354eadc6e2b1d0e4a808c3311697c8f2a0d65707.jpeg)

edit: same problem with the plexinc/pms-docker image (no :beta tag)

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [April 13, 2021, 8:37pm UTC](https://forums.plex.tv/t/docker-compose-1-29-0-hardware-transcoding/708900/9 "2021-04-13T20:37:02Z")

</div>

I chatted with the engineer who developed and supports the docker images.

He said, in short, that the Docker / Nvidia is such a `<Insert denegrating words here>` because it broke everything else.

For that reason, it has been left as manual.

---

<div class="post-metadata">

**Author:** ![D34DC3N73R](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/d34dc3n73r/32/108198_2.png) [@D34DC3N73R](https://forums.plex.tv/u/D34DC3N73R)\
**Post date:** [April 13, 2021, 11:10pm UTC](https://forums.plex.tv/t/docker-compose-1-29-0-hardware-transcoding/708900/10 "2021-04-13T23:10:43Z")

</div>

> [@ChuckPa](#):
>
> left as manual

Meaning what exactly? I’m fine using the linuxserver image, and just an FYI, the docker-compose update isn’t yet available in the Ubuntu apt repository. I don’t know how many people will update their containers to the new GPU schema when it does become available. I maintain an unrelated docker image that also uses GPUs, so I was trying out other containers with the new schema and noticed the issue with plex, so I wanted to report it.

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [April 13, 2021, 11:22pm UTC](https://forums.plex.tv/t/docker-compose-1-29-0-hardware-transcoding/708900/11 "2021-04-13T23:22:33Z")

</div>

Means exactly:

You pass through the device manually.

I have two GPUs (renderD128 and renderD129) so I can write it this way)

```auto
--device=/dev/dri:/dev/dri \

```

In the containerized PMS, if I want to use the 2nd GPU card, I specify:

```auto
HardwareDevicePath="/dev/dri/renderD129"

```

---

<div class="post-metadata">

**Author:** ![D34DC3N73R](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/d34dc3n73r/32/108198_2.png) [@D34DC3N73R](https://forums.plex.tv/u/D34DC3N73R)\
**Post date:** [April 13, 2021, 11:31pm UTC](https://forums.plex.tv/t/docker-compose-1-29-0-hardware-transcoding/708900/12 "2021-04-13T23:31:41Z")

</div>

AFAIK that’s not exactly possible when using nvidia GPUs as the drivers are [not included](https://github.com/plexinc/pms-docker/blob/master/Dockerfile) in the image. That process is only applicable with integrated GPU chipsets.

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [April 13, 2021, 11:33pm UTC](https://forums.plex.tv/t/docker-compose-1-29-0-hardware-transcoding/708900/13 "2021-04-13T23:33:02Z")

</div>

They aren’t and never are/were.

1. Install the appropriate Nvidia drivers for your system.
2. Create the container which points to the device.

Are you trying to create your own image file?

---

<div class="post-metadata">

**Author:** ![D34DC3N73R](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/d34dc3n73r/32/108198_2.png) [@D34DC3N73R](https://forums.plex.tv/u/D34DC3N73R)\
**Post date:** [April 13, 2021, 11:35pm UTC](https://forums.plex.tv/t/docker-compose-1-29-0-hardware-transcoding/708900/14 "2021-04-13T23:35:29Z")

</div>

No, I’m not interested in making another plex image. I’m stating that nvidia GPUs won’t work in the plex image without the appropriate drivers. Drivers installed on the host system will not be passed to the container without nvidia-container-toolkit.

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [April 13, 2021, 11:38pm UTC](https://forums.plex.tv/t/docker-compose-1-29-0-hardware-transcoding/708900/15 "2021-04-13T23:38:40Z")

</div>

Then install the toolkit

PMS in Docker, on a Ubuntu/Debian host, can be upgraded using `dpkg / apt-get`.

There’s nothing blocking what you’re trying to do AFAIK.

Time to start adding to the container as you need.

May I ask what you’re trying to do that the native package cannot do?

---

<div class="post-metadata">

**Author:** ![D34DC3N73R](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/d34dc3n73r/32/108198_2.png) [@D34DC3N73R](https://forums.plex.tv/u/D34DC3N73R)\
**Post date:** [April 14, 2021, 6:48am UTC](https://forums.plex.tv/t/docker-compose-1-29-0-hardware-transcoding/708900/16 "2021-04-14T06:48:08Z")

</div>

Installing the toolkit itself doesn’t inject drivers in every container automatically. You still need to A) use the `--gpus` flag with docker run v19.03+. Or B) use the schema in the OP with docker-compose v1.28.0+.

The “old” way in docker-compose required changing the default docker runtime from `runc` to `nvidia` (a wrapper for runc that accepts nvidia specific environment variables) in /etc/docker/daemon.json, or specifying `--runtime: nvidia` in the docker run command. As well as using `NVIDIA_DEVICES` and `NVIDIA_DRIVER_CAPABILITIES` environment variables. This method still works correctly with the official plex image.

Just “manually” passing the device path doesn’t work, because there are no drivers installed in the image itself.

```auto
  plex2:
    container_name: plex2
    image: plexinc/pms-docker
    restart: unless-stopped
    network_mode: host
    environment:
      - TZ=$TZ
      - PLEX_UID=$PUID
      - PLEX_GID=$PGID
    volumes:
      - /data/.config/plex2:/config
      - /mnt/media:/media
      - /dev/shm:/transcode
    devices:
      - /dev/dri/card0:dev/dri/card0

```

```auto
Apr 13, 2021 23:36:46.345 [0x7fe512ffd700] DEBUG - [Transcode] Codecs: testing h264_vaapi (encoder)
Apr 13, 2021 23:36:46.345 [0x7fe512ffd700] DEBUG - [Transcode] Codecs: hardware transcoding: testing API vaapi
Apr 13, 2021 23:36:46.345 [0x7fe512ffd700] DEBUG - [Transcode] Codecs: hardware transcoding: opening hw device failed - probably not supported by this system, error: Generic error in an external library
Apr 13, 2021 23:36:46.345 [0x7fe512ffd700] DEBUG - [Transcode] Codecs: testing h264_nvenc (encoder)
Apr 13, 2021 23:36:46.345 [0x7fe512ffd700] DEBUG - [Transcode] Codecs: hardware transcoding: testing API nvenc
Apr 13, 2021 23:36:46.346 [0x7fe512ffd700] ERROR - [Transcode] [FFMPEG] - Cannot load libcuda.so.1
Apr 13, 2021 23:36:46.346 [0x7fe512ffd700] ERROR - [Transcode] [FFMPEG] - Could not dynamically load CUDA
Apr 13, 2021 23:36:46.346 [0x7fe512ffd700] DEBUG - [Transcode] Codecs: hardware transcoding: opening hw device failed - probably not supported by this system, error: Unknown error occurred
Apr 13, 2021 23:36:46.346 [0x7fe512ffd700] DEBUG - [Transcode] Codecs: testing h264 (decoder) with hwdevice vaapi
Apr 13, 2021 23:36:46.346 [0x7fe512ffd700] DEBUG - [Transcode] Codecs: hardware transcoding: testing API vaapi
Apr 13, 2021 23:36:46.346 [0x7fe512ffd700] DEBUG - [Transcode] Codecs: hardware transcoding: opening hw device failed - probably not supported by this system, error: Generic error in an external library
Apr 13, 2021 23:36:46.346 [0x7fe512ffd700] DEBUG - [Transcode] Codecs: testing h264 (decoder) with hwdevice nvdec
Apr 13, 2021 23:36:46.346 [0x7fe512ffd700] DEBUG - [Transcode] Codecs: hardware transcoding: testing API nvdec
Apr 13, 2021 23:36:46.346 [0x7fe512ffd700] ERROR - [Transcode] [FFMPEG] - Cannot load libcuda.so.1
Apr 13, 2021 23:36:46.346 [0x7fe512ffd700] ERROR - [Transcode] [FFMPEG] - Could not dynamically load CUDA
Apr 13, 2021 23:36:46.346 [0x7fe512ffd700] DEBUG - [Transcode] Codecs: hardware transcoding: opening hw device failed - probably not supported by this system, error: Unknown error occurred

```

![image](https://global.discourse-cdn.com/plex/original/3X/f/b/fbfaf963a5ae4ce09c45f247c1271b70d05ea34e.jpeg)

Installing the drivers by entering the container `docker exec -it plex /bin/bash` is not “the docker way”. It’s a bad idea for a couple of reasons, the main one being that the drivers would have to be manually installed every single time the image is updated or replaced. If that’s your only option, you’re better off building your own image. Besides, the drivers and GPU card are accessible when using nvidia-container-toolkit.

As stated in the OP, I’m just raising the fact that the official plex image fails to use hardware transcoding with the new docker-compose 1.29.0 deploy schema, while other images (like emby, and even linuxserver plex) have no problem with it.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [July 13, 2021, 6:48am UTC](https://forums.plex.tv/t/docker-compose-1-29-0-hardware-transcoding/708900/17 "2021-07-13T06:48:49Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
