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.
STEP 3
Once you click on User-defined script, a new window will open. Follow the instructions below:
- General: In the Task field type in Your-Container-Name Stop. Check the “Enabled” option. Select root User.
- Schedule: Select Run on the following days then select the time that works for you.
- 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.
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.
After you click OK, type in your DSM Password then click Submit. Follow the instructions in the image below.
STEP 5
After you click Submit on STEP 4 the container of your choice will automatically stop at the scheduled time and date.
STEP 6
Go to Control Panel / Task Scheduler / Create / Scheduled Task / User-defined script. Follow the instructions in the image below.
STEP 7
Once you click on User-defined script, a new window will open. Follow the instructions below:
- General: In the Task field type in Your-Container-Name Start. Check the “Enabled” option. Select root User.
- Schedule: Select Run on the following days then select the time that works for you.
- 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.
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.
After you click OK, type in your DSM Password then click Submit. Follow the instructions in the image below.
STEP 9
After you click Submit on STEP 8 the container of your choice will automatically start at the scheduled time and date.
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.
This post was updated on Sunday / November 24th, 2024 at 9:33 PM