How to automatically delete a file within a container?

I am running a number of Linuxserver.io containers in docker, installed on Ubuntu 18.04 on a j4105 celeron system. I am also running watchtower, which keeps my containers automatically updated.

My problem is with my Plex container. It is a known issue with Plex that the iHD quick sync transcoder is incompatible with gemini lake processors. The current suggested workaround is to delete the file iHD_drv_video.so, so Plex will fall back to the functional i965 transcoder for hardware transcoding.

I can easily open a CLI interface with the container, and type “rm /usr/lib/plexmediaserver/lib/dri/iHD_drv_video.so” and the problem is solved.

However, every time watchtower updates the container with the latest version of Plex, the file is rewritten, and hardware transcoding is broken until I delete it again. Can someone please tell me the best way to alter my Docker compose file to automatically delete the iHD transcoder when watchtower updates the container?

Then use that to

rm /usr/lib/plexmediaserver/lib/dri/iHD_drv_video.so

Thank you for this info. Is the best way to go about this to create a custom script? I use Portainer to administer my containers. It has a console which allows me to log in as root. I logged in as root, created a new folder at “config/custom-cont-init.d” and I am ready to make a script. The instructions state it can be named anything, so I’m going with “rmihd”. I am kind of stuck here though. A couple of questions:

  1. does the script need a file type?
  2. do you have a suggestion as to how to edit the script within the container? I usually use nano to do CLI edits, but I can’t figure out what text editor I can install in the container.
  3. won’t a custom script be overwritten when the container is updated, if it exists within the container?

I am sorry for my low level of understanding. This project of trying to set up a media server is how I am learning Linux, CLI and Docker.

Custom Scripts

The first part of this update is the support for a user’s custom scripts to run at startup. In every container, simply create a new folder located at /config/custom-cont-init.d and add any scripts you want. These scripts can contain logic for installing packages, copying over custom files to other locations, or installing plugins.

One example use case is our Piwigo container has a plugin that supports video, but requires ffmpeg to be installed. No problem. Add this bad boy into a script file (can be named anything) and you’re good to go.

Tells you all that in this paragraph. Folder is in the mapped /config/ dir so persistent, and below this we have an example including the shebang.

The text editor is immateral you can edit this on the host, no need to do so from within the container.

Thank you for your help. With your info, I believe I’ve got the script working as desired.

1 Like