summaryrefslogtreecommitdiffstats
path: root/libexec/container/list
diff options
context:
space:
mode:
Diffstat (limited to 'libexec/container/list')
-rwxr-xr-xlibexec/container/list11
1 files changed, 10 insertions, 1 deletions
diff --git a/libexec/container/list b/libexec/container/list
index 3ef6e49..6567afb 100755
--- a/libexec/container/list
+++ b/libexec/container/list
@@ -368,7 +368,16 @@ do
case "${STATE}" in
started)
- ADDRESS="$(cnt run -n ${CONTAINER} -- hostname -I | sed -e 's|\r$||' | awk '{ print $1 }')"
+ case "${FORMAT}" in
+ shell|sh)
+ ;;
+
+ *)
+ LEADER="$(machinectl status ${CONTAINER} | awk '/Leader: / { print $2 }')"
+ ADDRESS="$(nsenter --all --target "${LEADER}" /bin/hostname -I | sed -e 's|\r$||' | awk '{ print $1 }')"
+ ;;
+ esac
+
ADDRESS="${ADDRESS:-none}"
;;