Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Script to restart docker service

Featured Replies

How would i restart docker service via script? Sometimes when i do a force shutdown and power back on. Dockers wont start and say no container. So if I go to settings and disable docker and reenable everything is fine. Is there a way to do this via script?

  • 3 weeks later...

It's pretty easy - 

 

docker restart ${dockerName}

 

  • Author
3 hours ago, bcjenkins said:

It's pretty easy - 

 


docker restart ${dockerName}

 

No i meant the actual docker service not a docker container

9 minutes ago, skyline7349 said:

No i meant the actual docker service not a docker container

/etc/rc.d/rc.docker ?
usage /etc/rc.d/rc.docker start|stop|restart|status

 

  • 3 months later...
On 6.12.2017 at 5:08 PM, bcjenkins said:

/etc/rc.d/rc.docker ?
usage /etc/rc.d/rc.docker start|stop|restart|status

 


Lets say i want to restart all dockers ondce a week, could i just restart the docker service? Will it close the dockers "correct" - soft?!

edit1:

Okay a simple restart didng seemed to work.

 

I have now:
 

#!/bin/bash
/etc/rc.d/rc.docker stop
echo "stopping docker"
/etc/rc.d/rc.docker start
echo "starting docker"

 

Edit2: Okay it worked once, now its not working anymore, any idea? (if i click run script, its just empty)

 

Edited by nuhll

  • 1 month later...
On 3/15/2018 at 8:38 AM, nuhll said:

Edit2: Okay it worked once, now its not working anymore, any idea? (if i click run script, its just empty)

 

 

Did you get this figured out?  Is what you have working now? 

 

You probably already know that In the scripts sub-directory for the cron you want to run, the script should be in a file simply called script.  First time I tried to setup a script, I created the script in the cron directory (i.e. nightly_reboot) and called it nightly_reboot.cron, which was ignored by user scripts and it created a file in the nightly_reboot folder called script, which was empty and thus ran that instead.

Edited by jeffreywhunter

I stoped using it because i have problems some contaienrs dont come back :(

  • 2 years later...

Not sure if people are still interested. But you can do the snippet below to restart all running docker containers. 

 

````

docker restart $(docker ps -q)

````

  • 3 years later...

I am also looking for a way to enable/disable docker service from user script/shell. Shell command to toggle the Settings, Docker, Enable Docker GUI item.

 

My current backup script dumps list of running dockers, stopping each one, running my backup and then restarting the dockers from the same list.

I have a docker startup timing/order issue and want the (autostart enabled) dockers to start in the dragged order of the Unraid Docker page along with the delay timings I have configured there.

 

Is there a command to accomplish this from shell?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.