add support for container ID files (a la pidfile)
docs - add cidfile flag to run docs
docs - add example for cidfile
create the cidfile before creating the container

This change makes docker attempt to create the container ID file and
open it before attempting to create the container. This avoids leaving
a stale container behind if docker has failed to create and open the
container ID file.

The container ID is written to the file after the container is created.