How to run tests with TestContainers without Docker Desktop (MacOS)


Step-by-step guide

  1. Remove the Docker Desktop from the machine.
  2. Download the Rancher Desktop installer from the release page (aarch64 for Apple processors, x86_64 for Intel)
  3. Install Rancher Desktop
  4. Open settings and configure Docker Desktop in the following way: 
    •  Disable Administrative Access in the General Section: 
    • Change Virtual Machine Type to VZ:
    • Change Container Engine to dockerd(moby)
    • Optionally: adjust hardware parameters 
  5. Restart your computer and reopen Rancher Desktop
  6. Add the next environment variables and run your tests: 
export DOCKER_HOST=unix://$HOME/.rd/docker.sock
export TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE=/var/run/docker.sock
export TESTCONTAINERS_HOST_OVERRIDE=$(rdctl shell ip a show vznat | awk '/inet / {sub("/.*",""); print $2}')