From 67630dcbbfc2af52a4e07c551daaad1ee5962677 Mon Sep 17 00:00:00 2001 From: Ade Attwood Date: Sat, 26 Jun 2021 20:47:25 +0100 Subject: [PATCH] feat(shell): add `dkip` alias to the ip address of a container This alias will inspect a container and pull out the ip address so you can get to it on the network without having to bind ports. --- site-modules/core/files/oh-my-zsh/custom/docker.zsh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/site-modules/core/files/oh-my-zsh/custom/docker.zsh b/site-modules/core/files/oh-my-zsh/custom/docker.zsh index 47915f8..6eca923 100644 --- a/site-modules/core/files/oh-my-zsh/custom/docker.zsh +++ b/site-modules/core/files/oh-my-zsh/custom/docker.zsh @@ -30,6 +30,10 @@ function dktop() { docker stats --format "table {{.Container}}\t{{.Name}}\t{{.CPUPerc}} {{.MemPerc}}\t{{.NetIO}}\t{{.BlockIO}}" } +function dkip() { + docker inspect $1 | jq -r '.[0].NetworkSettings.Networks | .[].IPAddress' +} + # # Docker Compose #