skyline7349 Posted November 20, 2017 Share Posted November 20, 2017 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? Quote Link to comment
bcjenkins Posted December 6, 2017 Share Posted December 6, 2017 It's pretty easy - docker restart ${dockerName} Quote Link to comment
skyline7349 Posted December 6, 2017 Author Share Posted December 6, 2017 3 hours ago, bcjenkins said: It's pretty easy - docker restart ${dockerName} No i meant the actual docker service not a docker container Quote Link to comment
bcjenkins Posted December 6, 2017 Share Posted December 6, 2017 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 Quote Link to comment
NewDisplayName Posted March 15, 2018 Share Posted March 15, 2018 (edited) 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, 2018 by nuhll Quote Link to comment
jeffreywhunter Posted May 11, 2018 Share Posted May 11, 2018 (edited) 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, 2018 by jeffreywhunter Quote Link to comment
NewDisplayName Posted May 12, 2018 Share Posted May 12, 2018 I stoped using it because i have problems some contaienrs dont come back Quote Link to comment
5252525111 Posted June 24, 2020 Share Posted June 24, 2020 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) ```` 1 Quote Link to comment
Recommended Posts
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.