Append instead of replace file contents

I think the `DOCKER_OPTS` should be appended to `/etc/default/docker` and not replace the entire contents.
Merge pull request #8023 from nerab/patch-1

Append instead of replace file contents
graph: validate tags properly & add unit tests

Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
Merge pull request #8049 from unclejack/fix_tag_validation

graph: validate tags properly & add unit tests