Skip to main content
Version: Latest

Using Testcontainers on Rancher Desktop

Rancher Desktop can be used with Testcontainers to execute ephemeral tests and containers that work inside Docker. This guide demonstrates the use of Testcontainers with a sample repository.

Prerequisites​

Testcontainers can only be used with the moby (dockerd) runtime as it requires a Docker-API compatible container runtime. Kubernetes must be disabled for machines on Apple Silicon. The setting can be disabled via the Preferences > Kubernetes dialog, or by using the rdctl command below:

rdctl set --kubernetes-enabled=false

Please also ensure that Apache Maven is installed on your machine in order to make use of the mvn verify command.

You can download a sample test repository in the testcontainers-java-repro located here: https://github.com/testcontainers/testcontainers-java-repro

After the repository is downloaded, please navigate to the testcontainers-java-repro folder and run the command mvn verify.

mvn verify

After the command has been run, you should see a BUILD SUCCESS with test statistics for failures, number of tests ran, skipped tests, time elapsed, and errors.