Skip to content

Instantly share code, notes, and snippets.

@michaellwest
Last active January 22, 2023 04:36
Show Gist options
  • Save michaellwest/51d4337e89f93a0c69a3ad3260071473 to your computer and use it in GitHub Desktop.
Save michaellwest/51d4337e89f93a0c69a3ad3260071473 to your computer and use it in GitHub Desktop.
List Docker Container Name and IPAddress as a table using PowerShell.
docker ps -q | ForEach-Object { "Name,IPAddress" } { $data = docker inspect $_ --format '{{json .Name}},{{range .NetworkSettings.Networks}}{{json .IPAddress}}{{end}}'; $data.replace('/','') } | ConvertFrom-Csv
<#
Name IPAddress
---- ---------
spe-traefik-1 172.31.127.71
spe-cm-1 172.31.126.246
spe-id-1 172.31.116.201
spe-mssql-1 172.31.120.96
spe-solr-1 172.31.121.74
#>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment