Update /etc/hosts when linked container is restarted

Carry of #7092

closes #7092
fixes #6350

/cc @vieux
I think we should use `runCommandWithOutput` and print output in `Fatal`. Because now test failing for me and I have no idea why.