Created
October 16, 2015 03:29
-
-
Save pnathan/5f6666ccc47f2d0a4142 to your computer and use it in GitHub Desktop.
keep-those-containers-running
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 | |
| # downloads docker container. | |
| running_id=$(docker ps | grep "$1" | cut -f1 -d' ') | |
| docker pull "$1" | grep 'up to date' | |
| if [[ "$?" -eq "1" ]]; then | |
| docker kill $running_id | |
| fi | |
| docker ps | grep $1 | |
| if [[ "$?" -eq "1" ]]; then | |
| docker run -d -e "VIRTUAL_HOST=$2" "$1" | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment