Update /etc/hosts when linked container is restarted

Fix #6350


Should we do this with `defer` in beginning of test?