obtenir ou filtrer ou ouput docker ps colonnes personnalisées

To get all container names and their IP addresses in just one single command.

docker inspect -f '{{.Name}} - {{.NetworkSettings.IPAddress }}' $(docker ps -aq)
If you are using docker-compose the command will be this:

docker inspect -f '{{.Name}} - {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -aq)
The output will be:

/containerA - 172.17.0.4
/containerB - 172.17.0.3
/containerC - 172.17.0.2

another example:
docker ps | grep sida | tr -s ' ' | awk '{print $NF}' | xargs docker inspect $1 -f "{{.Name}} - {{json .NetworkSettings.Networks }}" | grep -i networkID
 
 The output will be:
 /docker-compose-sida_web_1 => {"docker-traefik_default":{"IPAMConfig":null,"Links":null,"Aliases":["web","de2326288433"],"NetworkID":"ebc5e603ab6b43c1b0f1853bb182ab6eb39ed86df0131d9fd0d2126cc7aaae82","EndpointID":"00e5c590339cc415eb6505e57ed0a5f009ee6d0ff323987e2c25bfd2d4f26a2c","Gateway":"172.21.0.1","IPAddress":"172.21.0.7","IPPrefixLen":16,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"MacAddress":"02:42:ac:15:00:07","DriverOpts":null}}
DreamCoder