Synology: Schedule Start & Stop For Docker Containers

Synology: Schedule Start/Stop For Docker Containers

If you have a Synology NAS and are using it extensively, then you’ve likely already installed a number of Docker containers to serve your various needs, whether for work or fun. But circumstance may make it that you may need to stop and start back up again certain containers automatically at scheduled times. So today I’m going to show you how to stop and start, or restart, your Docker containers and organize their activity around a schedule that fits your individual needs.

  • STEP 1

Please Support My work by Making a Donation.

  • STEP 2

Go to Control Panel / Task Scheduler / Create / Scheduled Task / User-defined script. Follow the instructions in the image below.

Synology Schedule Start and Stop For Docker Containers 1 2024

  • STEP 3

Once you click on User-defined script, a new window will open. Follow the instructions below:

  1. General: In the Task field type in Your-Container-Name Stop. Check the “Enabled” option. Select root User.
  2. Schedule: Select Run on the following days then select the time that works for you.
  3. Task Settings: Check “Send run details by email“, add your email then copy paste the code below in the Run command area. After that, click OK.
synowebapi --exec api=SYNO.Docker.Container version=1 method=stop name="containername"

Note: In the image below pihole is an example of a docker container. You have to choose the name of the container you want to stop at a scheduled time.

Synology Schedule Start and Stop For Docker Containers 2 2024

  • STEP 4

After you click OK on STEP 3 a new warning pop up window will open. Click OK. Follow the instructions in the image below.

Synology Schedule Start and Stop For Docker Containers 3 2024

After you click OK, type in your DSM Password then click Submit. Follow the instructions in the image below.

Synology Task Scheduler Confirm Admin Password

  • STEP 5

After you click Submit on STEP 4 the container of your choice will automatically stop at the scheduled time and date.

Synology Schedule Start and Stop For Docker Containers 4 2024

  • STEP 6

Go to Control Panel / Task Scheduler / Create / Scheduled Task / User-defined script. Follow the instructions in the image below.

Synology Schedule Start and Stop For Docker Containers 5 2024

  • STEP 7

Once you click on User-defined script, a new window will open. Follow the instructions below:

  1. General: In the Task field type in Your-Container-Name Start. Check the “Enabled” option. Select root User.
  2. Schedule: Select Run on the following days then select the time that works for you.
  3. Task Settings: Check “Send run details by email“, add your email then copy paste the code below in the Run command area. After that, click OK.
docker container start yourcontainername

Note: In the image below pihole is an example of docker container. You have to choose the name of the container you want to start at a scheduled time.

Synology Schedule Start and Stop For Docker Containers 6 2024

  • STEP 8

After you click OK on STEP 7 a new warning pop up window will open. Click OK. Follow the instructions in the image below.

Synology Schedule Start and Stop For Docker Containers 7 2024

After you click OK, type in your DSM Password then click Submit. Follow the instructions in the image below.

Synology Task Scheduler Confirm Admin Password

  • STEP 9

After you click Submit on STEP 8 the container of your choice will automatically start at the scheduled time and date.

Synology Schedule Start and Stop For Docker Containers 8 2024

  • STEP 10

In the Task Scheduler area you have the option to enable or disable the schedule for your docker containers. Check or uncheck the boxes according to your needs.

Synology Schedule Start and Stop For Docker Containers 9 2024

This post was updated on Sunday / November 24th, 2024 at 9:33 PM