brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: schedule docker stop and start with User Scripts and a cron line

Docker
~/tips/tip-unraid-user-scripts-docker-schedule

docker stop "container-name"

Stops or starts a chosen Docker container at a fixed time using the User Scripts plugin.

Unraid cannot start or stop a container on a schedule by itself. The docs name the plugin that can.

Install User Scripts from the Apps tab, then open Settings, User Scripts. Make a new script, put the Docker commands in it and choose a schedule. For anything the dropdown does not cover there is a custom cron expression.

#!/bin/bash
docker stop "container-name"

Use the container name as shown on the Docker tab. The docs give 0 3 * * 1 as an example, which runs a script at 3:00 every Monday. A second script with docker start gives you the matching morning.

Scripts that share a schedule can live in one script. Put the stop commands for several containers together and you only need one entry. The same docs page lists docker restart, docker ps with a name filter and docker logs for the other jobs.

The caveat: stopping a container that is writing data or serving someone is not free. Pick a quiet hour, and do not stop the container your own Tailscale or DNS depends on unless you know what that cuts off.

Further reading: Unraid docs: Managing and customizing containers, On this site: Docker data-root can be a directory instead of a docker.img vDisk, On this site: give Docker containers a wait time in the Unraid autostart column

More Docker tips ONBUILD RUN /usr/local/bin/python-build --dir /app/src SHELL ["/bin/bash", "-c"] docker commit <container> myname/testimage:version3 docker import /path/to/exampleimage.tgz docker compose events All Docker tips (192) All topics

Link