Skip to content
Snippets Groups Projects
Commit 57831658 authored by jurgenhaas's avatar jurgenhaas
Browse files

#70 Add a list command

parent 30431cb9
No related branches found
No related tags found
No related merge requests found
......@@ -6,5 +6,5 @@ echo ""
echo "Version: ${VERSION}"
echo "Support: https://gitlab.lakedrops.com/docker/l3d"
echo ""
echo "Usage: l3d [ help | version | selfupdate [VERSION] | update | reset | PROJECTNAME | delete PROJECTNAME ]"
echo "Usage: l3d [ help | version | selfupdate [VERSION] | update | reset | PROJECTNAME | delete PROJECTNAME ] | list"
echo ""
#!/bin/bash
function listprojects() {
echo ""
docker container ls --all -q -f name=_l3d$ > /tmp/l3d.lst
IDS=$(cat /tmp/l3d.lst)
if [[ ! -n ${IDS} ]]; then
echo "No active L3D projects found."
return
fi
echo "Active L3D projects:"
echo "===================="
echo ""
for CONTAINERID in `cat /tmp/l3d.lst`; do
docker inspect $CONTAINERID | jq -r .[0].Config.Hostname | cut -d'-' -f 1
done
rm /tmp/l3d.lst
}
function listnetworks() {
echo ""
docker network ls -q -f name=^traefik_ > /tmp/l3d.lst
IDS=$(cat /tmp/l3d.lst)
if [[ ! -n ${IDS} ]]; then
echo "No active L3D networks found."
return
fi
echo "Active L3D networks:"
echo "===================="
echo ""
for NETWORKID in `cat /tmp/l3d.lst`; do
docker inspect $NETWORKID | jq -r .[0].Name | cut -d'_' -f 2
done
rm /tmp/l3d.lst
}
listprojects
listnetworks
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment