【发布时间】:2019-03-05 21:25:49
【问题描述】:
我想通过Spotify将文件复制到未运行的容器中-
文件的创建方式类似于 -
File.createTempFile("olb-", "-temp").deleteOnExit().writeText("some text")
当我尝试时:
client.copyToContainer(inputFileProvider.createFile(task.dataToInsert).toPath(), containerId, "/app/asd.json")
我明白了:
Either container 1adbf9c1ee511272bec78a46be08bf9299c317b11cdb176eed986640ac86a38c or path /app/my_json.json not found.
好吧,我在使用RUN touch /app/my_json.json 构建映像时创建了这个文件
下一次运行:
client.copyToContainer(inputFileProvider.createFile(task.dataToInsert).toPath(), containerId, "/app/my_json.json")
导致
{"message":"extraction point is not a directory"}
好的...我尝试了目录
copyToContainer(inputFileProvider.createFile(task.dataToInsert).toPath(), containerId, "/app/")
结果:
{"message":"Error processing tar file(exit status 1): cannot overwrite directory \"/\" with non-directory \"/\""}
"/app" 也一样
任何想法如何通过 Java 客户端将文件复制到 docker 容器中?
【问题讨论】:
标签: java docker kotlin spotify spotify-docker-client