Docker-java: Copy archive from container not working

Created on 28 Dec 2016  路  3Comments  路  Source: docker-java/docker-java

I am trying to copy a log file which is created by a script from container and the log file is located in '/logfile' in container. As I am using 3.0.7-SNAPSHOT version of docker-java, 'CopyFileFromContainerCmdImplTest.java' is showing not available. So I am using "CopyArchiveFromContainerCmdImplTest.java" to copy the log file from container to '/tmp/' in docker host. But after successful execution of the method I see the output of the file in the terminal of the IDE(see screenshot) but not file name 'logfile' is available in '/tmp/' of the host machine. The content of the logfile is

This is a test script with parameter param1
Created a new file

screenshot from 2016-12-28 17-37-27

I use the following process -

InputStream response = dockerClient
              .copyArchiveFromContainerCmd(containerId, "/logfile")
              .withHostPath('/tmp/')
              .exec();

Any idea why I am not able to get the 'logfile' in the "/tmp/" directory of the host machine?

Is there any way available to read the output of the file? I used "response.read()" but its not the right way.

Most helpful comment

I'm facing to a similar issue using copyArchiveFromContainerCmd. It seems the returned InputStream is corrupted. @Sakib37 Did you manage to solve this problem?

All 3 comments

I'm facing to a similar issue using copyArchiveFromContainerCmd. It seems the returned InputStream is corrupted. @Sakib37 Did you manage to solve this problem?

I have the same issue with copyArchiveFromContainerCmd

@Sakib37 Maybe in #991 you can find a solution for your problem.

Was this page helpful?
0 / 5 - 0 ratings