rpc error: code = Unknown desc = failed to build LLB

I am working on this docker build which fails on this line:

RUN --mount=type=ssh pip install --no-cache-dir -r requirements.txt

The terminal output shows all the requirements being installed but then I get the following failure:

failed to solve with frontend dockerfile.v0: 
failed to solve with frontend gateway.v0: 
rpc error: code = Unknown desc = failed to build LLB: 
executor failed running [/bin/sh -c pip install --no-cache-dir -r requirements.txt]: 
runc did not terminate sucessfully

I am on Windows 10 + WSL (v1) + Ubuntu 18.04

A colleague runs the same project on Mac OS and does not have any issues…

Any idea what’s going wrong? How do I debug it?

Source: StackOverflow