Wait for the container terminate at the end of CmdRun

Fixes the race condition between docker run and docker logs from #428.
Merge pull request #444 from lopter/master

Fixe the race condition between docker run and docker logs from #428