Search code examples
dockerherokudockerfileheroku-cli

How to store and retrieve data (files, images etc.) in docker?


I am new to docker. Recently I hosted an docker image(Asp.net core published contents with asp.net core runtime) on heroku. It is working fine. I am using LiteDB, serverless database, for my application.

Every time when I deploy new changes on heroku(new docker image with changes), the old LiteDB data file gets removed.

What I want to do is only to deploy the new docker image that will use the old LiteDB data file that was already on the container(Heroku container).

Is there any way to store data(files, images etc.) on docker and retrieve data anytime when i required? eg. in above case, copy my LiteDB data file to local computer.


IF

I am doing the above work wrong please provide me the correct way to do that.

Thanks.


Solution

  • This is not something you can do on Heroku (VOLUME is unsupported).

    Your only solution is to store the data file somewhere else, such as Amazon S3. Or to use a server-side database, such as PostgreSQL.