From 5c3fbecb207a39fc07d79988dd2b3f235338f2b3 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 25 Jul 2021 15:50:05 +0200 Subject: Speeding up container list command by optimizing IP address gathering. Signed-off-by: Daniel Baumann --- libexec/container/list | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libexec') diff --git a/libexec/container/list b/libexec/container/list index 17a1958..6567afb 100755 --- a/libexec/container/list +++ b/libexec/container/list @@ -373,7 +373,8 @@ do ;; *) - ADDRESS="$(cnt run -n ${CONTAINER} -- hostname -I | sed -e 's|\r$||' | awk '{ print $1 }')" + LEADER="$(machinectl status ${CONTAINER} | awk '/Leader: / { print $2 }')" + ADDRESS="$(nsenter --all --target "${LEADER}" /bin/hostname -I | sed -e 's|\r$||' | awk '{ print $1 }')" ;; esac -- cgit v1.2.3