Skip to content

Instantly share code, notes, and snippets.

@heywoodlh
Last active June 23, 2022 21:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save heywoodlh/42abd3358288cb881a86d980751d82c0 to your computer and use it in GitHub Desktop.
Save heywoodlh/42abd3358288cb881a86d980751d82c0 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
if limactl list | grep -q docker
then
echo 'lima docker vm exists'
else
echo 'lima docker vm does not exist -- creating now'
limactl start --name=docker template://docker --tty=false
fi
while read line
do
if echo ${line} | grep -q Running
then
echo 'Lima already running'
else
limactl stop -f docker
limactl start docker
fi
done < <(while true; do limactl list | grep docker ; sleep 2; done)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment