Initially Populating a Volume

I’m building a application that has a configuration volume for Home Assistant. I would like it to be pre-populated with a set of files, so that defaults have what I need. Any thoughts on how to achieve this?



Hi @crbn60

Perhaps the following sections in our documentation can point you in the right direction:

If you need more guidance, please provide some more details regarding your setup and what exactly you would like to accomplish, and we would be glad to help.

Kind regards

Thanks for your reply @AlidaOdendaal.

I understand how to create volumes, that’s done.

What I want to do is to use a third-party Docker image that stores its configuration on a named volume, as many do. But I want to provide an initial default set of files on that named volume so my users don’t have to do it themselves. An example is Home Assistant.

Thank you,


Hi @crbn60, you may want to take a look at our Home Assistant implementation here: - note how we create a persistent volume in the docker-compose file, then use COPY in the Dockerfile to copy some default configuration files into the container, and finally a startup script to copy them onto the persistent volume. The startup script could be changed to only do that copy if the file does not yet exist on the volume, so it does not always overwrite the file on start up.

1 Like