Unfortunately Oracle databases aren’t compatible with the new Apple Silicon CPU architecture. Due to this fact you’re not able to run an Oracle XE image with TestContainers on your brand-new MacBook, but there’s a workaround!

TLDR;

  • Install colima

  • Run colima start --arch x86_64 --memory 4

  • Set TestContainers env vars

    export TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE=/var/run/docker.sock
    export DOCKER_HOST="unix://${HOME}/.colima/docker.sock"
  • Run your tests based on Gerald Venzl's Oracle XE image

The workaround

To overcome this issue, you need to run your database TestContainer on an x86_64 virtual machine with colima.

Colima is a tool to have container runtimes on macOS with minimal setup. As we’ll be running the Oracle XE database on colima, we’ll also be using an Oracle XE docker image, maintained by Gerald Venzl

Install and Run

  • Install colima with your favorite package manager for Mac.

  • Run colima start --arch x86_64 --memory 4, the --arch x64_86 is the important part here to match the CPU architecture to be compatible with the Oracle XE docker images, the additional memory-flag is for performance reasons.

  • Set TestContainers env vars, you may add these to your Bash Profile (~/.bash_profile) or ZShell profile (~/.zshrc) or any other profile you like.

    export TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE=/var/run/docker.sock
    export DOCKER_HOST="unix://${HOME}/.colima/docker.sock"
  • Run your tests based on Gerald Venzl's Oracle XE image

shadow-left