title: spin redis from docker-it-scala
body: <p>I am trying to spin a docker container from <a href="https://github.com/whisklabs/docker-it-scala" rel="nofollow noreferrer">docker-it-scala</a>.
  The goal is to be able to run unit tests against the redis in the container as opposed to prod which is a managed service (AWS ElastiCache)</p>
  
  <p>I build a Service, following quite closely the </p>
  
  <pre><code>import com.spotify.docker.client.{DefaultDockerClient, DockerClient}
  import com.whisk.docker.impl.spotify.SpotifyDockerFactory
  import com.whisk.docker.{DockerContainer, DockerFactory, DockerKit, DockerReadyChecker}
  
  // Look at https://github.com/whisklabs/docker-it-scala
  // .. and let yourself be inspired
  trait DockerRedisService extends DockerKit {
  
    val redisDefaultPort = 6379
  
    val redisContainer = DockerContainer("redis")
      .withPorts(redisDefaultPort -&gt; None)
      .withReadyChecker(DockerReadyChecker.LogLineContains("Ready to accept connections"))
  
    abstract override def dockerContainers: List[DockerContainer] =
      redisContainer :: super.dockerContainers
  
  }
  </code></pre>
  
  <p>From there, I should be able to run some unit tests</p>
  
  <pre><code>class ElastiCache extends FlatSpec with Matchers with BeforeAndAfter with ScalaFutures with DockerRedisService {
  
    private val client: DockerClient = DefaultDockerClient.fromEnv().build()
    override implicit val dockerFactory: DockerFactory = new SpotifyDockerFactory(client)
  
    implicit val pc = PatienceConfig(Span(40, Seconds), Span(1, Second))
  
    "the redis container" should "be ready with log line checker" in {
      isContainerReady(redisContainer).futureValue shouldBe true
      redisContainer.getPorts().futureValue.get(6379 ) should not be empty
      redisContainer.getIpAddresses().futureValue should not be Seq.empty
    }
  </code></pre>
  
  <p>The unit test just times out without too much information.</p>
  
  <p>It would be useful to see how I could hset and hget some values out of that redis.</p>