How can i mount volume to the container?

163 Views Asked by At

I try to mount volumes to the container when configuring it:

  private def buildApiCheckerContainerConfig(cfg: ApiCheckerConfig): ContainerConfig = {
val specVol: Volume = client.createVolume(
  Volume.builder()
    .name("openapi.yaml")
    .mountpoint("/app/openapi.yaml")
    .build()
)
val paramsVol: Volume = client.createVolume(
  Volume.builder()
    .name("parameters.yaml")
    .mountpoint("/app/parameters.yaml")
    .build()
)
ContainerConfig.builder()
  .image("andyceo/openapi-checker:latest")
  .addVolumes(specVol.name(), paramsVol.name())
  .cmd("openapi.yaml", "--api", s"${cfg.apiAddress}", "--parameters", "parameters.yaml")
  .build()

}

But volumes not found in container: No such file or directory: '/app/openapi.yaml'

How can I do something like docker run -v /path/to/openapi.yaml:/app/openapi.yaml with the spotify-docker-client?

0

There are 0 best solutions below