Last active
May 21, 2020 00:23
-
-
Save oozman/1e83ad2fc8b7d99f2f1a0d250ac1fa6c to your computer and use it in GitHub Desktop.
Revisions
-
oozman revised this gist
May 21, 2020 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,9 @@ #!/bin/bash # Usage: ./restart.bash <container-name> <domain name> CONTAINER_NAME=$1 CONTAINER_DOMAIN=$2 # Build docker build -t $CONTAINER_NAME . @@ -26,6 +27,6 @@ then fi # Run the container again. docker run -d -e VIRTUAL_HOST=$CONTAINER_DOMAIN --restart always --name $CONTAINER_NAME $CONTAINER_NAME echo "Container has been restarted." -
oozman revised this gist
May 7, 2020 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,7 @@ #!/bin/bash # Usage: ./restart.bash <container-name> CONTAINER_NAME=$1 # Build -
oozman created this gist
May 7, 2020 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ #!/bin/bash CONTAINER_NAME=$1 # Build docker build -t $CONTAINER_NAME . # Check if container is running. CONTAINER_IDS=$(docker ps -aq --filter name=$CONTAINER_NAME) IS_CONTAINER_RUNNING=0 if [ -z "$CONTAINER_IDS" ] then IS_CONTAINER_RUNNING=0 else IS_CONTAINER_RUNNING=1 fi # Stop and delete container, if it's running if [[ $IS_CONTAINER_RUNNING -eq 1 ]] then docker stop $CONTAINER_IDS docker rm $CONTAINER_IDS echo "Container has been stopped." fi # Run the container again. docker run -d -p 8000:80 --name $CONTAINER_NAME $CONTAINER_NAME echo "Container has been restarted."