Connecting to Docker's Unix socket in GitHub Actions

I have a NodeJS application which uses dockerode to start/stop/restart Docker containers at runtime and during testing. This library connects (by default) to the socket at /var/run/docker.sock.

When I run my tests with GitHub Actions, I get the following error:


Error: (HTTP code 500) server error - driver failed programming external connectivity on endpoint charming_galileo (b311961c4c8a6f4be0ddf32649914325fdc2671dbf63f62442b44536a3ff1d02): invalid transport protocol: 0

I’m struggling to figure out what protocol I should be using, and if what I’m doing is even possible with GitHub actions. The library says that the protocol http/https is determined automatically.

Hard to help you without a link to the minimal action and log that reproduces the problem.

My original assumption was that error was being thrown due to a connection failure between dockerode and the host socket, however after some more debugging it wasn’t the case. The connection was in fact made properly. Turns out an ENV variable that I use in the test code wasn’t set, which caused the test code to try to start containers with incorrect configurations.