I'm using Java Docker API and I'm trying to send my text file to the docker container but the file doesn't appear there. I imagine this happens because the file has no title? How can I give the input stream a title?
我正在使用Java Docker API,我正在尝试将我的文本文件发送到docker容器,但该文件没有出现在那里。我想这会发生,因为文件没有标题?如何为输入流提供标题?
final String configDir = "C:/teste/configuration.txt";
File file = new File(configDir);
InputStream input = new FileInputStream(file);
TarArchiveInputStream tarArchiveInputStream = new TarArchiveInputStream(input,"UTF-8");
dockerClient.copyArchiveToContainerCmd("1025c61de603")
.withRemotePath("/tmp/")
.withTarInputStream(tarArchiveInputStream)
.exec();
EDIT: I Don't get any error in my catch. Seems everything works fine but doesn't create. If you know a easy way to send a file to docker container in Java tell me please
编辑:我的捕获没有任何错误。似乎一切正常,但不创造。如果您知道一种简单的方法将文件发送到Java中的docker容器请告诉我
1 个解决方案
#1
0
Use Files.copy(source, target, REPLACE_EXISTING);
to rename files.
使用Files.copy(source,target,REPLACE_EXISTING);重命名文件。
#1
0
Use Files.copy(source, target, REPLACE_EXISTING);
to rename files.
使用Files.copy(source,target,REPLACE_EXISTING);重命名文件。