Pause container when other container in use

I have a pi I take with me on the road to be my media server. Is it possible to pause all my arr containers when I am using my Jellyfin?

Any input is appreciated.

If you really want to pause all containers, you can do it this way:

docker container ls -q | xargs -- docker container pause

Replace “pause” with stop" if you meant stopping containers.

I am aware of this option, but my hope was to automate. When a client to Jellyfin starts using Jellyfin, ie communicating with the Jellyfin server, my other dockers would be paused. (Currently I have to log into Portainer and pause them all otherwise Jellyfin is glitch.)

I don’t understand the use case so I can’t give you an answer. Maybe if you can share why you need it, what’s your final goal, that could help me start to think. Docker is not involved here. You open a jellyfin server in the browser so only Jellyfin could do anything which won’t. If you have a special case, you could write an proxy that recognizes that you want to open jellyfin and stop the other containers, but I still don’t know what it would be for, so this is all I can tell you for now.

I want to give JellyFin as much resource as possible when using it. If I pause all other containers when watching shows then JellyFin works almost flawlessly. Is it possible via proxy to selectively pause docker containers when watching shows/movies?

So basically, you are expecting docker to be application aware and trigger actions based on the application behavior.

If you find a solution that does the same for processes running on your host, please share the solution, and we can try to containerize it with you.

From your response it seems I am hoping for too much? (Maybe traffic aware vs application aware.)

Dockers responsibility ends at running an isolated process that thinks it is a standalone machine with its own network and filesystem. Of course this is oversimplified :slight_smile:

So no, docker is neither traffic aware, nor application aware.

You would need to build something yourself that takes care of monitoring, alerting to trigger something that actually stops/starts the containers. You could build it with the help of Prometheus and Alertmanager, preferably based on a Prometheus export of Jellyfin (if it provides it) that can tell whether transcoding is used or not. Note: It is nothing I can recommend to beginners. Maybe you find someone in the Jelyyfin community that takes care of the heavy liftiing for you.

Maybe you can use Traefik as reverse proxy with a plugin (link).