Skip to content

Instantly share code, notes, and snippets.

@gopinath-langote
Last active June 18, 2019 11:37
Show Gist options
  • Save gopinath-langote/008a1bffbe2bf3c05397ce006adc2100 to your computer and use it in GitHub Desktop.
Save gopinath-langote/008a1bffbe2bf3c05397ce006adc2100 to your computer and use it in GitHub Desktop.
Start docker on mac if already not running
#!/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