如何将体积装入容器?

时间:2018-09-29 13:20:18

标签: spotify-docker-client

我在配置容器时尝试将卷挂载到容器上

  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()

}

但是在容器No such file or directory: '/app/openapi.yaml'中找不到卷

如何使用spotify-docker-client做类似docker run -v /path/to/openapi.yaml:/app/openapi.yaml的事情?

0 个答案:

没有答案