Created
September 6, 2018 09:03
-
-
Save adrienjoly/3170f543c330939adcf9b022ae7640c9 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bash | |
# Script to restart docker | |
# Useful to re-synchronise clocks, cf https://forums.docker.com/t/time-in-container-is-out-of-sync/16566 | |
# Tested on macOS only. | |
echo "Stopping Docker containers..." | |
docker-compose down | |
echo "Stopping Docker gracefully..." | |
test -z "$(docker ps -q 2>/dev/null)" && osascript -e 'quit app "Docker"' | |
echo "Starting Docker..." | |
open --background -a Docker | |
echo "(Docker may take ~50 seconds to restart)" | |
until docker ps >/dev/null 2>/dev/null; do sleep 5; done | |
echo "Restarting Docker containers..." | |
docker-compose up -d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment