get label value from docker inspect

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

You can use index to get the value of that key (wrapped for readability);

docker inspect \
  --format '{{ index .Config.Labels "com.docker.compose.project"}}' \
  new_sc2_1

That should give you the name of the project