Run command on docker container from Supervised HASSIO

I’m trying to create a script that I can run from HA to scan my Plex libraries for new content. I know that I can use the Plex Media Scanner to manually scan libraries. However, I’m getting confused since I’m running Plex in a Docker container. To further complicate the issue, I’m running HA Supervised in Docker as well.

Maybe I’m overthinking this, but the script would basically have to escape the HA container, then connect to the console of the Plex container to run the command.

Does anyone have any experience doing something similar?

Have you tried the (relatively new) plex.refresh_library service?

@dmartinez7500 correct you need to escape the container. Most people do this by SSHing into the host machine.


  mount_nuc_drives: !secret shell_mount_nuc_drives


shell_mount_nuc_drives: ssh [email protected] -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa 'source ~/scripts/'

This will give you a shell_command.mount_nuc_drives service you can call. The command will be called from inside the Docker container, at which point it will SSH in to the host machine (davids-nuc.local in this example but could be IP address) and execute that script.

But as @jjlawren mentioned there is an existing service you can call from Home Assistant in this case. Only execute scripts on the host where necessary like this mounting drives example.