I get this error after running docker run --rm -it IMAGE_TAG.
The problem was that the image I was using wasn't really an image to execute in Docker but a set of steps to build a Python wheel package (.whl).
The solution was to only build the image specifying an --output directory to which the resulting wheel file could be copied.
DOCKER_BUILDKIT=1 docker build --output folder_to_save_wheel .