I want to copy the files generated inside a docker container, to the local storage before stopping/killing the container.
I am creating an docker image.
I am using docker run --name <docker_container_name> --mount type=bind,source=%cd%,target=<folder> <docker_image> <python_path> python_script.py
to create and run a container.
After the python script is executed, the container will be deleted automatically.
I want at the end, before stopping/killing the container, to copy the files from inside the container to the local storage.
Do you have any ideas how can I do that?
I was thinking to use docker create
and then docker start
to run the container, and then to stop it after some time and to copy the files with docker cp
.