Tuned PR #8980

This is a small adjustment of the work done by @rhatdan and @tiborvass. It
suppresses redundant error messages and handles a case where docker is run with
a bad option without a command.

Fixes #8980 and closes #7887
like here