-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: introduce redis_up and redis_up_verbose functions
- Loading branch information
1 parent
287bb5e
commit 93253e3
Showing
1 changed file
with
26 additions
and
6 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,38 @@ | ||
|
||
|
||
|
||
function docker_prune_none() { | ||
docker_prune_none() { | ||
for IMG in $(docker images | grep none | awk '{print $3}'); do | ||
docker image remove -f $IMG | ||
done | ||
} | ||
|
||
|
||
|
||
function docker_get_ip() { | ||
docker_get_ip() { | ||
local CONTAINER_ID="$1" | ||
|
||
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $CONTAINER_ID | ||
} | ||
|
||
redis_up() { | ||
docker run --rm -p 6379:6379 --name redis -d redis:latest | ||
} | ||
|
||
redis_up_verbose() { | ||
docker run --rm -p 6379:6379 --name redis redis:latest | ||
} | ||
|
||
docker_stop_all() { | ||
for i in $( docker ps -q ); docker stop $i | ||
} | ||
|
||
_docker_logs_all_cleanup() { | ||
kill $(jobs -p) | ||
exit 0 | ||
} | ||
|
||
docker_logs_all() { | ||
trap _docker_logs_all_cleanup SIGINT SIGTERM | ||
container_ids=$(docker ps -q) | ||
for cid in $container_ids; do | ||
docker logs -f $cid & | ||
done | ||
wait | ||
} |