Last active
June 18, 2019 11:37
-
-
Save gopinath-langote/008a1bffbe2bf3c05397ce006adc2100 to your computer and use it in GitHub Desktop.
Start docker on mac if already not running
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function run_docker_on_mac_if_not_running() { | |
echo "docker starting" | |
if (! docker stats --no-stream ); then | |
echo "Opening docker" | |
# Change location of app if different | |
open /Applications/Docker.app | |
# Wait until Docker daemon is running and has completed initialisation | |
while (! docker stats --no-stream ); do | |
# Docker takes a few seconds to initialize | |
echo "Waiting for Docker to launch..." | |
sleep 1 | |
done | |
echo "docker started" | |
fi | |
} | |
run_docker_on_mac_if_not_running |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment