Inside my docker image I am creating a FBX file. After the file is finished processing I want to export to my local machine. I want to do this from docker image.
Yes! Let the docker save image command and the docker export image command do the trick! In this tutorial, you'll learn how to save and export containers and images for sharing by running Docker commands.
To export a container, we use the docker export command. The documentation describes export as follows: docker export – Export a container's filesystem as a tar archive. As we can see, this is just a regular old Linux file system — the BusyBox file system created when running our image, to be precise.
The docker export - Export a container's filesystem as a tar archive. The docker import - Import the contents from a tarball to create a filesystem image. The docker save - Save one or more images to a tar archive (streamed to STDOUT by default) The docker load - Load an image from a tar archive or STDIN.
Run your container as this:
docker run -v $(PWD)/local-dir/:/path/to/results/dir (...rest of the command..)
So any file that is created inside the container into /path/to/results/dir
gets automatically reflected in your host, inside ./local-dir
.
Alternatively, you can copy any file from container to host:
docker cp <container-id>:/path/to/file ./local-dir
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With