add port to func docker_ips
This commit is contained in:
parent
16ade75418
commit
3f5e30e6e9
@ -125,12 +125,13 @@ docker_ex() {
|
||||
|
||||
# ips of docker containers
|
||||
docker_ips() {
|
||||
local DOC IP OUT NAME
|
||||
local DOC IP OUT NAME PORT
|
||||
for DOC in $(docker ps -q | tr '\n' ' ')
|
||||
do
|
||||
IP="$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}} {{end}}' "$DOC")"
|
||||
IP="$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "$DOC")"
|
||||
PORT="$(docker inspect --format='{{range $p, $conf := .NetworkSettings.Ports}}{{(index $conf 0).HostPort}}{{end}}' "$DOC")"
|
||||
NAME="$(docker inspect --format='{{.Name}}' "$DOC")"
|
||||
OUT+="${NAME#"/"}"'\t'"$IP"'\n'
|
||||
OUT+="${NAME#"/"}"'\t'"$IP":"$PORT"'\n'
|
||||
done
|
||||
echo -e $OUT | column -t
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user