whisklabs / docker-it-scala

Docker integration testing kit with Scala
MIT License
431 stars 91 forks source link

Cannot healthcheck mysql:5.6 image #40

Closed Saandji closed 8 years ago

Saandji commented 8 years ago

I am trying to run mysql:5.6 image with health check, but it always fails. My code:

trait DockerMySqlService extends DockerKit {

val MySqlAdvertisedPort = 3306
val Database = "database"
val User = "user"
val Password = "password"

val mySqlContainer = DockerContainer("mysql:5.6")
  .withPorts((MySqlAdvertisedPort, Some(MySqlAdvertisedPort)))
  .withEnv(
    s"MYSQL_ALLOW_EMPTY_PASSWORD=yes",
    s"MYSQL_DATABASE=$Database",
    s"MYSQL_USER=$User",
    s"MYSQL_PASSWORD=$Password")
  .withReadyChecker(DockerReadyChecker.LogLineContains("MySQL entered RUNNING state"))

abstract override def dockerContainers: List[DockerContainer] =
  mySqlContainer :: super.dockerContainers

}

trait Bootstrapper extends DockerMySqlService { startAllOrFail() }

any ideas?

viktortnk commented 8 years ago

Not sure if it will be helpful, but below is working for 5.7:

trait DockerMysqlService extends DockerKit {

  def MysqlAdvertisedPort = 3306
  val MysqlUser = "root"
  val MysqlPassword = "mysecretpassword"
  val MysqlDatabase = "db"

  val mysqlContainer = DockerContainer("mysql:5.7.14")
    .withPorts((MysqlAdvertisedPort, None))
    .withEnv(s"MYSQL_USER=$MysqlUser", s"MYSQL_ROOT_PASSWORD=$MysqlPassword", s"MYSQL_DATABASE=$MysqlDatabase")
    .withReadyChecker(
      DockerReadyChecker
        .LogLineContains("MySQL init process done. Ready for start up.")
    )

  abstract override def dockerContainers: List[DockerContainer] =
    mysqlContainer :: super.dockerContainers
}
viktortnk commented 8 years ago

Closing. Let me know if you are still having and issue with that