mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-30 04:33:00 +02:00
board/common: add container --net IFNAME locate
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
@@ -280,6 +280,7 @@ commands:
|
||||
help Show this help text
|
||||
list [image | oci] List names (only) of containers, images, or OCI archives
|
||||
load [NAME | URL] NM Load OCI tarball fileNAME or URL to image NM
|
||||
locate Find container that currently owns '--net IFNAME'
|
||||
remove IMAGE Remove an (unused) container image
|
||||
restart [network] NAME Restart a (crashed) container or container(s) using network
|
||||
run NAME [CMD] Run a container interactively, with an optional command
|
||||
@@ -474,6 +475,23 @@ case $cmd in
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
locate) # Find where the host's ifname lives
|
||||
if [ -z "$network" ]; then
|
||||
echo "Missing --net IFNAME option."
|
||||
exit 1
|
||||
fi
|
||||
containers=$(podman ps $all --format "{{.Names}}")
|
||||
for c in $containers; do
|
||||
json=$(podman inspect "$c")
|
||||
nets=$(echo "$json" |jq -r '.[].NetworkSettings.Networks | keys[]' 2>/dev/null)
|
||||
for n in $nets; do
|
||||
if [ "$network" = "$n" ]; then
|
||||
echo "$c"
|
||||
exit 0;
|
||||
fi
|
||||
done
|
||||
done
|
||||
;;
|
||||
ls | list)
|
||||
cmd=$1
|
||||
[ -n "$cmd" ] && shift
|
||||
|
||||
Reference in New Issue
Block a user