Last active
May 14, 2018 15:34
-
-
Save grantcooksey/98b7a02f7ef9d34afa31cbbdaa84c6d7 to your computer and use it in GitHub Desktop.
Start up docker containers when opening shell
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 | |
# Got tired of manually starting up docker containers when rebooting my computer | |
# so I made this to spin them up when I open my shell. Tuck this into your *_profile file | |
containers=('$container_id') | |
for container in ${containers[@]}; do | |
container_active=$(docker inspect -f '{{.State.Running}}' $container) | |
if [ "$container_active" != "true" ]; then | |
docker start $container | |
echo "Started container "$container | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment