File tree Expand file tree Collapse file tree
main/java/com/github/dockerjava/core/command
test/java/com/github/dockerjava/cmd Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -143,6 +143,7 @@ public Void exec() throws NotFoundException {
143143 } catch (IOException e ) {
144144 throw new DockerClientException ("Unable to read temp file " + toUpload .toFile ().getAbsolutePath (), e );
145145 } finally {
146+ this .tarInputStream = null ;
146147 // remove tmp docker-javaxxx.tar.gz
147148 toUpload .toFile ().delete ();
148149 }
Original file line number Diff line number Diff line change 11package com .github .dockerjava .cmd ;
22
3+ import com .github .dockerjava .api .command .CopyArchiveToContainerCmd ;
34import com .github .dockerjava .api .command .CreateContainerResponse ;
45import com .github .dockerjava .api .exception .NotFoundException ;
56import com .github .dockerjava .core .command .WaitContainerResultCallback ;
@@ -47,6 +48,17 @@ public void copyStreamToContainer() throws Exception {
4748 assertFileCopied (container );
4849 }
4950
51+ @ Test
52+ public void copyStreamToContainerTwice () throws Exception {
53+ CreateContainerResponse container = prepareContainerForCopy ("rerun" );
54+ CopyArchiveToContainerCmd copyArchiveToContainerCmd =dockerRule .getClient ().copyArchiveToContainerCmd (container .getId ())
55+ .withHostResource ("src/test/resources/testReadFile" );
56+ copyArchiveToContainerCmd .exec ();
57+ assertFileCopied (container );
58+ //run again to make sure no DockerClientException
59+ copyArchiveToContainerCmd .exec ();
60+ }
61+
5062 private CreateContainerResponse prepareContainerForCopy (String method ) {
5163 CreateContainerResponse container = dockerRule .getClient ().createContainerCmd ("busybox" )
5264 .withName ("docker-java-itest-copyToContainer" + method + dockerRule .getKind ())
You can’t perform that action at this time.
0 commit comments