-
Notifications
You must be signed in to change notification settings - Fork 645
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
Need capability to copy files from running container to host #752
Comments
I just realized that the solution I proposed above won't work in my case. Please disregard it. How can I keep the container running after maven exits? I would like to copy the files I need from the container before stopping the container.
|
I think the best solution is to use a docker volume mount to share the directory inside your container that contains the files you want, with the host machine. The Your XML section might look like this: ...
<volumes>
<bind>
<volume>${project.basedir}/target:${container.work.dir}/target/results</volume>
</bind>
</volumes>
... Then, when your running container writes to its This will work with the existing docker-maven-plugin. |
Thanks @Gengar003! That suggestion definitely put me on the right track! |
with volume-bind mounts you have another problem if your container is running under a $user account. In my case i want to measure code-coverage with a jacoco agent and pull the results out of the container to merge them with other jacoco-results. |
I work around that by adding a
Then when I start a container that will write to
This leaves the contents of the This does assume that the container you're running can |
This feature is still looking must have for me (I'm using builder image and need to copy built binaries from container to the maven project) because I use remote Docker instance and solution suggested in that comment doesn't work for such case while Note: I cannot use multi-stage build due to old version of Docker (RHEL 7) |
I started implementation of this feature in master...mabrarov:copy_mojo. Working example with usage of new version of docker-maven-plugin can be found in feature/docker-maven-plugin-copy-mojo branch of mabrarov/maven-docker-builder. Volunteers wanted to complete and polish the changes. What's missing at the moment:
Here is one more (more complicated and closer to real project) sample using docker builder pattern and |
Could you please reopen this issue? I don't like duplicates, so prefer to not open a new issue, just because the old closed one was found not needed at the time it was closed. Thank you. |
@mabrarov reopened |
I opened pull request #1405. Though it lacks some of the things, but it already works for me in mabrarov/redis-builder. |
I suggest to look at mabrarov/redis-builder for those who wants to try <plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.34-dev</version>
</plugin> |
When this will be released? |
Hi @qalinn,
Refer to #1412 (comment). I can work on pull request #1405 and complete it, but it doesn't look like it will be accepted before the mentioned cleanup. |
Description
Unable to copy files in the target directory after tests have completed from container to host.
If this is already currently possible with the plugin, please let me know.
Info
mvn -v
) :Docker version : 17.03.1-ce, build c6d412e
If it's a feature request, what is your use case :
The use case I have is I'd like to copy the test results in my target directory in the post-integration-test phase from within the running container to the host.
Would be great if we could do something like this -
The text was updated successfully, but these errors were encountered: