I read lots of Rust code, even built some Rust to test things out, but could not figure out how the io error from the logs is triggered.
But I found that relay supports multiple http client libraries as it is moving from actix-web-client to reqwest. The DNS problems come from the resolver that actix-web uses so I configured relay with the other library like this in relay/config.yml:
http:
_client: "reqwest"
Docker compose down/up, then relay uses the other http library and (after a couple of seconds) it works!