Add a file/template to a docker volume

What would be the best approach to get a file (based on template) into a docker volume?

Right now I copy the file to the host and then mount the hosts folder to the data volume.
This works but I would rather directly add the file to the data volume without linking a host folder to the container.

Any ideas?