Can't connect to node HTTP server running on localhost

Hmm, OK. I am not familiar with Yarn, but it looks to me that your server is called Gatsby, and that seems to be starting up after the sleep, thus defeating its purpose. Moreover, I cannot see where gatsby is started up in your config.

I don’t think so. The run line is run inside your container, and if you can run the tests in a subsequent SSH session, then you’ve not changed anything.

I wonder, try using 127.0.0.1 instead of localhost? I have seen some rare envs where the name was not defined.