Skip to content

Latest commit

 

History

History
61 lines (40 loc) · 1.78 KB

File metadata and controls

61 lines (40 loc) · 1.78 KB

🚢🍏 Testcontainers with Socktainer Sample

This project demonstrates how to use Testcontainers with Socktainer, which provides a socket interface on top of Apple container.

⚙️ Socktainer Configuration

Socktainer must be configured to expose a socket that Testcontainers can use instead of the Docker socket.

🔧 Configure Socket Usage for TestContainers

Following the Testcontainers Docker host configuration, configure the Docker host to use Socktainer:

1. Environment Variable (recommended):

export DOCKER_HOST=unix://$HOME/.socktainer/container.sock

2. System Property:

-Ddocker.host=unix://$HOME/.socktainer/container.sock

3. Testcontainers Configuration File (~/.testcontainers.properties):

docker.host=unix://$HOME/.socktainer/container.sock

Note: Replace $HOME with the actual path in the properties file.

⚠️ Disable Ryuk Container

The Ryuk container expects to mount some Docker socket in containers. For now, this is not supported in Socktainer mode.

Use the environment variable TESTCONTAINERS_RYUK_DISABLED=true when running Maven:

TESTCONTAINERS_RYUK_DISABLED=true mvn install

🚀 Running the Sample

📋 Prerequisites

  • ☕ Java 23 or higher
  • 📦 Maven 3.9 or higher
  • 🔌 Socktainer running with socket exposed (run ./socktainer)

🏃‍♂️ Start Socktainer

Assuming Socktainer is not running, start it now:

./socktainer
[ NOTICE ] Server started on http+unix: $HOME/.socktainer/container.sock

🧪 Run Tests with Ryuk Disabled

TESTCONTAINERS_RYUK_DISABLED=true mvn test