Skip to content

Commit

Permalink
fix(docker): add restart-docker-daemon task and executable
Browse files Browse the repository at this point in the history
This commit adds a new task `restart-docker-daemon` to the `Taskfile.dist.yaml` and an executable script to be able to restart the Docker daemon. It uses `systemctl` to restart the daemon in Linux systems and `service` if the system is WSL.
  • Loading branch information
entelecheia committed May 9, 2023
1 parent 422014a commit 8431f6b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
5 changes: 5 additions & 0 deletions chezmoi/Taskfile.dist.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ tasks:
cmds:
- watch -n 1 nvidia-smi

restart-docker-daemon:
desc: Restart the Docker daemon
cmds:
- restart-docker-daemon

# install-node:
# desc: Install the latest LTS version of Node.js using nvm
# cmds:
Expand Down
10 changes: 10 additions & 0 deletions chezmoi/dot_local/bin/executable_restart-docker-daemon.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
# {{ template "scripts-library" }}

log_task "Restarting Docker daemon"
# {{ if .system.is_wsl }}
# service restart fails if the service was never started
c service docker restart || c service docker start || true
# {{ else }}
c systemctl restart docker
# {{ end }}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,4 @@
log_task "95. Restarting Docker daemon"

# daemon.json hash: {{ include "/etc/docker/daemon.json" | sha256sum }}

log_task "Restarting Docker daemon"
# {{ if .system.is_wsl }}
# service restart fails if the service was never started
c service docker restart || c service docker start || true
# {{ else }}
c systemctl restart docker
# {{ end }}
"${HOME}/.local/bin/restart-docker-daemon"

0 comments on commit 8431f6b

Please sign in to comment.