Copy file from container to host during build process
How to copy files from docker container to host machine during command docker build
?
As part of building my docker image for my application, I am running some tests inside it and I would like to copy the result of the test run to the host (which is a continuous integration server) to do some reporting.
source to share
I would not run tests at build time, it will only increase the size of your image. I would recommend that you create an image and then launch it by setting the host host to a container and changing the working directory to the mount point.
docker run -v `pwd`/results:/results -w /results -t IMAGE test_script
source to share
There is no easy way to do this. Volumes are created only at run time. You can retrieve it from the docker filesystem (e.g. my is / var / lib / docker / devicemapper / mnt / CONTAINER_ID / rootfs / PATH_TO_FILE), although there is no way to figure out when your test process will terminate. You can create the file when it finishes and do inotify, but that's ugly.
source to share