November 20, 20178 yr 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?
December 6, 20178 yr Author 3 hours ago, bcjenkins said: It's pretty easy - docker restart ${dockerName} No i meant the actual docker service not a docker container
December 6, 20178 yr 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
March 15, 20188 yr 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 March 15, 20188 yr by nuhll
May 11, 20188 yr 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 May 11, 20188 yr by jeffreywhunter
June 24, 20206 yr 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) ````
June 18, 20242 yr 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.