Lately I have found myself working a lot with containers with bind mounts and found no elegant way to display all of them in one go.
The command below gives you a nice overview as a json array. You need to have jq installed.
docker inspect $(docker ps -a -q) | jq '[.[] | {Id: .Id[0:12], Name: .Config.Hostname, Image: .Config.Image, Binds: .HostConfig.Binds}]'
[
{
"Id": "0b45da2797b0",
"Name": "container-1",
"Image": "image.store/example-image:latest",
"Binds": [
"/srv/docker/dir1/:/etc/config/svc:ro",
"/srv/docker/common/:/etc/config/common/:ro"
]
},
{
"Id": "e7d52c7ee759",
"Name": "container-2",
"Image": "image.store/example-image:latest",
"Binds": [
"/srv/docker/dir2/:/etc/config/svc:ro",
"/var/app/:/var/app:rw",
"/srv/docker/common/:/etc/config/common/:ro"
]
},
{
"Id": "71bdfcbd47a6",
"Name": "container-3",
"Image": "image.store/example-image:latest",
"Binds": [
"/srv/docker/dir3/:/etc/config/svc:ro",
"/srv/docker/common/:/etc/config/common/:ro"
]
}
]