Fix Panic with -t and -a stderr

Fixes #6983

At present, running docker with the -t and -a stderr flags (but no -a stdout) causes a panic. Adding a check to terminal hijack to ensure io.Copy is only used if STDOUT is attached fixes this.

Tested with all combinations of -a std(out|err|in) and -t, no regressions I can find.