This project demonstrates how to use Testcontainers with Socktainer, which provides a socket interface on top of Apple container.
Socktainer must be configured to expose a socket that Testcontainers can use instead of the Docker socket.
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.
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
- β Java 23 or higher
- π¦ Maven 3.9 or higher
- π Socktainer running with socket exposed (run
./socktainer
)
Assuming Socktainer is not running, start it now:
./socktainer
[ NOTICE ] Server started on http+unix: $HOME/.socktainer/container.sock
TESTCONTAINERS_RYUK_DISABLED=true mvn test