Avoids problems when container user is non-root. Added a test for this and the --no-rewrite-hosts flag.