Created
July 7, 2021 20:58
-
-
Save dallasmarlow/786c6f8e0b27bd817daaff942b895ee3 to your computer and use it in GitHub Desktop.
docker fish scripts
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
#!/usr/bin/env fish | |
source ../include/env.fish | |
source ../include/build_and_push.fish |
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
#!/usr/bin/env fish | |
docker build -t $DOCKER_TAG . | |
if test -z $SKIP_PUSH | |
docker push $DOCKER_TAG | |
end |
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
#!/usr/bin/env fish | |
set DOCKER_REG nas.local:5000 | |
set DOCKER_IMG (basename (pwd)) | |
set DOCKER_TAG $DOCKER_REG/$DOCKER_IMG |
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
#!/usr/bin/env fish | |
docker pull $DOCKER_TAG |
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
#!/usr/bin/env fish | |
set CONTAINER_NAME registry | |
set DOCKER_TAG $CONTAINER_NAME:2 | |
set MNT_PATH /mnt/docker-$CONTAINER_NAME | |
source ../include/pull.fish | |
source ../include/util.fish | |
terminate $CONTAINER_NAME | |
docker run \ | |
--name=$CONTAINER_NAME \ | |
--net=host -d \ | |
-v $MNT_PATH:/var/lib/registry \ | |
$DOCKER_TAG |
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
#!/usr/bin/env fish | |
source ../include/env.fish | |
source ../include/pull.fish | |
source ../include/util.fish | |
set CONTAINER_NAME $DOCKER_IMG | |
terminate $CONTAINER_NAME | |
docker run \ | |
--name=$CONTAINER_NAME \ | |
--network=host -d \ | |
$DOCKER_TAG |
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
#!/usr/bin/env fish | |
function kill_if_running | |
for c in $argv | |
echo -n "container '$c' running? - " | |
docker inspect --format="{{.State.Running}}" $c | grep true | |
if test $status -eq 0 | |
echo -n "killing container: " | |
docker kill $c | |
end | |
end | |
end | |
function rm_if_exists | |
for c in $argv | |
echo -n "container '$c' exist? - " | |
docker ps -a --format="{{.Names}}" | grep $c | |
if test $status -eq 0 | |
echo -n "removing container: " | |
docker rm $c --force | |
end | |
end | |
end | |
function terminate | |
for c in $argv | |
kill_if_running $c | |
rm_if_exists $c | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment