about summary refs log tree commit diff
path: root/docker-ip
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>1970-01-01 03:00:00 +0300
committerAzat Bahawi <azat@bahawi.net>2022-09-20 11:57:34 +0300
commitfcf8d0c0246b353f255eb5173cd8cd3748f8da3b (patch)
tree50717852ab2d895415a77b64462de4723322c404 /docker-ip
chore: init HEAD master
Diffstat (limited to 'docker-ip')
-rwxr-xr-xdocker-ip8
1 files changed, 8 insertions, 0 deletions
diff --git a/docker-ip b/docker-ip
new file mode 100755
index 0000000..e4da369
--- /dev/null
+++ b/docker-ip
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+for i in $(docker ps -q | awk '{print $1}'); do
+    ip=$(docker inspect --format="{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}" "${i}")
+    name=$(docker ps | awk -v i="${i}" '/i/ {print $NF}')
+
+    printf "%s\t%s\n" "${ip}" "${name}"
+done

Consider giving Nix/NixOS a try! <3