Determining application execution context Normal vs. Container

I’ve read about a few informal ways for an application to determine that it is running inside of a Docker container. Most of this involves hardcoding this of that in respect to current Docker/LXC implementation.

Is there a more official C/C++ library, maintained by the Docker team, offering a small set of tools for an application running in a container? For now, my only concern is discriminating whether the application is running inside of a container or not.

I agree that the later might be questionable and ultimately irrelevant but until the entire software is updated there might be a need to short circuit stuff like logging to rsyslog, using GPU, graphic libraries etc.