Skip to content

Commit

Permalink
feat: introduce redis_up and redis_up_verbose functions
Browse files Browse the repository at this point in the history
  • Loading branch information
andersonbosa committed Jun 9, 2024
1 parent 287bb5e commit 93253e3
Showing 1 changed file with 26 additions and 6 deletions.
32 changes: 26 additions & 6 deletions moshell.sh/custom/andersonbosa/docker.sh
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
}

0 comments on commit 93253e3

Please sign in to comment.