-
Notifications
You must be signed in to change notification settings - Fork 0
Setup
docker-it-scala can work with two underlying libraries to communicate to docker engine through REST API or unix socket.
- Spotify's docker-client (used in Whisk)
- docker-java
Note: there is no specific recommendation to use one of them, over the other, but we hear people using Spotify's one more often, so you might get better support for it.
There are separate artifacts available for these libraries:
Spotify's docker-client
libraryDependencies ++= Seq(
"com.whisk" %% "docker-testkit-scalatest" % "0.9.5" % "test",
"com.whisk" %% "docker-testkit-impl-spotify" % "0.9.5" % "test")
docker-java
libraryDependencies ++= Seq(
"com.whisk" %% "docker-testkit-scalatest" % "0.9.5" % "test",
"com.whisk" %% "docker-testkit-impl-docker-java" % "0.9.5" % "test")
You don't necessarily have to use scalatest
dependency as demonstrated above.
You can create your custom bindings into your test environment, whether you use different initialisation technique or different framework.
Have a look at this specific trait
If you need to have custom setup for you environment, you need to override dockerFactory
field, providing DockerClient
instance
import com.spotify.docker.client.{DefaultDockerClient, DockerClient}
import com.whisk.docker.{DockerFactory, DockerKit}
trait MyCustomDockerKitSpotify extends DockerKit {
private val client: DockerClient = DefaultDockerClient.fromEnv().build()
override implicit val dockerFactory: DockerFactory = new SpotifyDockerFactory(client)
}
Check docker-client library project for configuration options.
You should be able to provide configuration purely through environment variables.
Examples:
export DOCKER_HOST=tcp://127.0.0.1:2375
export DOCKER_HOST=unix:///var/run/docker.sock