Consistent hosts

This patch makes `/etc/hosts` file records consistent between container restarts.
Fixes #8972 
Yeah, the problem is that `WriteTo` has weird signature with `int64` as return value. And we don't need to implement `WriterTo` here. WDYT?