Last active
January 8, 2021 21:20
-
-
Save lukeawyatt/8f106360963cfe41f2e3970cb3858ff3 to your computer and use it in GitHub Desktop.
Shell: Docker
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
docker run –i –t --rm ubuntu sh –c /bin/bash |
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 | |
for file in /home/user/docker-active/*.sh; do | |
echo $file | |
[ -f "$file" ] && [ -x "$file" ] && "$file" | |
done | |
docker system prune -a -f --volumes |
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
# PULL DOCKER IMAGES | |
echo "1) PULLING IMAGE" | |
docker pull AUTHOR/REPO:VERSION_TAG | |
echo;echo; | |
# STAGE ENVIRONMENT | |
echo "2) STAGING ENVIRONMENT" | |
echo "Creating volume directory..." | |
mkdir -p /STORAGE/volumes/CONTAINERNAME | |
echo "Stopping existing container if exists..." | |
docker stop CONTAINERNAME | |
echo "Removing existing container if exists..." | |
docker rm CONTAINERNAME | |
echo;echo; | |
# RUN CONTAINERS | |
echo "3) RUNNING CONTAINER" | |
docker run \ | |
--volume /STORAGE/volumes/CONTAINERNAME:/data \ | |
--restart=unless-stopped \ | |
--publish=3000:3000 \ | |
--detach=true \ | |
--name=CONTAINERNAME \ | |
AUTHOR/REPO:VERSION_TAG | |
echo;echo; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment