-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Created method which copy file from repository to container #378
Changes from 1 commit
3902ead
6d34017
7b6b1f7
eaf07e5
01fed46
4dd3f44
3d028fc
e2f7df4
752ef0f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -418,6 +418,8 @@ ExecResult execInContainer(Charset outputCharset, String... command) | |
|
||
InspectContainerResponse getContainerInfo(); | ||
|
||
void copyFileToContanier(String localPath, String containerPath); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo as well |
||
|
||
void setExposedPorts(List<Integer> exposedPorts); | ||
|
||
void setPortBindings(List<String> portBindings); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -850,6 +850,27 @@ public ExecResult execInContainer(String... command) | |
return execInContainer(UTF8, command); | ||
} | ||
|
||
/** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please move the JavaDoc to |
||
* | ||
* Method allow to copy file which we have in our repository to docker container | ||
* | ||
* @param localPath path with file which we would like to place in container | ||
* @param containerPath path where we want to copy file | ||
*/ | ||
@Override | ||
public void copyFileToContanier(String localPath, String containerPath){ | ||
|
||
if (!isRunning()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. since |
||
throw new IllegalStateException("Container is not running so copy cannot be run"); | ||
} | ||
|
||
this.dockerClient | ||
.copyArchiveToContainerCmd(this.containerId) | ||
.withHostResource(localPath) | ||
.withRemotePath(containerPath) | ||
.exec(); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest using
MountableFile
instead ofString localPath