Add wdockerd
This commit is contained in:
parent
dc625d9b45
commit
9530cd413a
1 changed files with 26 additions and 0 deletions
26
simpleDots/bin/wdockerd
Executable file
26
simpleDots/bin/wdockerd
Executable file
|
@ -0,0 +1,26 @@
|
|||
#!/bin/bash
|
||||
############################################################################
|
||||
##
|
||||
# wdockerd
|
||||
# Start dockerd inside a tmux session for use in WSL
|
||||
#
|
||||
#
|
||||
|
||||
## Ask for sudo credentials
|
||||
sudo --validate
|
||||
|
||||
if ! $(sudo --non-interactive /bin/true)
|
||||
then
|
||||
echo "We cannot become root with sudo. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
## Check for a tmux session with docker fo:wqr root is already running
|
||||
if $(sudo --non-interactive bash -c 'tmux has-session -t wdockerd')
|
||||
then
|
||||
echo "A wdockerd session is already running. Attaching."
|
||||
sudo --non-interactive tmux attach -t wdockerd
|
||||
else
|
||||
echo "Starting a new dockerd tmux-session."
|
||||
sudo --non-interactive tmux new-session -d -s wdockerd dockerd
|
||||
fi
|
Reference in a new issue