determine OS distribution of a docker image

You could use /etc/issue file for Debian/Ubuntu:

root@ubuntu_container:/# cat /etc/issue
Ubuntu 14.04.3 LTS \n \l

or /etc/redhat-release for CentOS/Red Hat/Fedora:

[root@fedora_container /]# cat /etc/redhat-release 
Fedora release 23 (Twenty Three)

[root@centos_container /]# cat /etc/redhat-release 
CentOS Linux release 7.2.1511 (Core)

The Filesystem Hierarchy Standard has a standard definition for /etc/os-release, which should be available on most distributions:

The /etc/os-release and /usr/lib/os-release files contain operating system identification data.

The basic file format of os-release is a newline-separated list of environment-like shell-compatible variable assignments. It is possible to source the configuration from shell scripts.

This means you can just source /etc/os-release and use $NAME or $ID to identify the distribution. As an example, on Fedora it looks like this:

% source /etc/os-release
% echo $NAME
Fedora
% echo $ID
fedora

On Debian:

% source /etc/os-release
% echo $NAME
Debian GNU/Linux
% echo $ID
debian