Have you followed the instructions provided in test containers for Rancher Desktop? These should fix the problem you are facing.
In short, you'll need to export DOCKER_HOST, TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE, and TESTCONTAINERS_HOST_OVERRIDE variables based on your rancher installation and choice of emulators.