Skip to content

Instantly share code, notes, and snippets.

@grantcooksey
Last active May 14, 2018 15:34
Show Gist options
  • Save grantcooksey/98b7a02f7ef9d34afa31cbbdaa84c6d7 to your computer and use it in GitHub Desktop.
Save grantcooksey/98b7a02f7ef9d34afa31cbbdaa84c6d7 to your computer and use it in GitHub Desktop.
Start up docker containers when opening shell
#! /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