Cache dependencies in a docker volume

Right now I am caching dependencies when building the image by running cargo fetch before I copy in the source code. However, I also want to be able to cache the dependencies in a persisting docker volume even when the container is not running- during development. How do I put the output of cargo fetch in a volume?
I also want my project to provide a template for other users, right now in the dockerfile I am copying the built binary into a smaller image and running the built binary. The name of this binary is taken from the name field in Cargo.toml. How would I allow the user to change the name and still know which binary to copy? I have tried writing and executing a bash script that would get "name" from the Cargo.toml but had no success.

You might be interested in cargo vendor.

Regarding the getting stuff into / from a docker container, look for docker volumes; it seems like it should be useful for your use case (IIUC).