You could pipe the output of docker inspect
to jq
. Given content like this:
...
"Labels": {
"com.docker.compose.config-hash": "a804d541a5828f4aaf17df862b650e58ac5bae77b70ff5ebdb2f0f3682326954",
"com.docker.compose.container-number": "1",
"com.docker.compose.oneoff": "False",
"com.docker.compose.project": "postgis",
"com.docker.compose.service": "postgis",
"com.docker.compose.version": "1.7.0rc1"
}
...
I can extract an individual label value like this:
docker inspect mycontainer |
jq -r '.[0].Config.Labels["com.docker.compose.project"]'
Which gets me:
postgis