I’m currently faced with the same issue. I also tried to manually add a command to be executed in the config file without luck.
The hosts file is handled by docker, and typically you need to use --add-host to achieve this. I don’t yet know how to add this argument to the startup of the discourse container.