我在配置时尝试将卷安装到容器:
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'
如何docker run -v /path/to/openapi.yaml:/app/openapi.yaml
使用 spotify-docker-client 做类似的事情?