Support for running docker containers in tests. This project offers an simple alternative to Test Containers or for when Test Containers will not work for your use-case (Scala.js or Scala Native builds).

Apache2.0 license


Add the following to your project/plugins.sbt file:

For sbt 1.0:

addSbtPlugin("com.lifeway" % "sbt-testdocker" % "1.0.0")


To use Test Docker in your project you can call start-test-docker and stop-test-docker directly in sbt.


To have test-docker automatically startup a container and stop it after tests are complete. In this example, we are starting up dynamodb-local and binding it to port 8000 on the host. When the tests are complete, the dynamodb-local container will be shutdown.

testDockerConfig := Some(DockerConfig("amazon/dynamodb-local", 8000, 8000)),
testDockerStart  := testDockerStart.dependsOn(Test / compile).value,
Test / test      := (Test / test).dependsOn(testDockerStart).value,
Test / testOnly  := (Test / testOnly).dependsOn(testDockerStart).evaluated,
Test / testQuick := (Test / testQuick).dependsOn(testDockerStart).evaluated,
Test / testOptions += testDockerCleanup.value


This work was based on the [sbt-dynamodb] ( plugin by localytics.