Created
August 9, 2024 16:39
-
-
Save yoandresaav/1b8bfc33c72f41e1d9f0a260926af87c to your computer and use it in GitHub Desktop.
If Docker is not running, Run Docker
This file contains hidden or 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 | |
# Check if docker is running and start it if it's not | |
if docker info > /dev/null 2>&1; then | |
echo "Docker is running" | |
else | |
echo "Docker is not running" | |
open /Applications/Docker.app | |
echo "Docker is starting" | |
while ! docker info > /dev/null 2>&1; do | |
echo -n "." | |
sleep 1 | |
done | |
echo "Docker is running" | |
fi | |
# Stop all running containers | |
echo "Stopping all docker containers" | |
docker stop $(docker ps -a -q) | |
# Up all containers | |
echo "Running docker-compose up" | |
docker-compose up |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment