Data get's deleted when strapi container restarts

In the various Dockerfile scripts that I see in the message trail above, one - critical - thing seems to be missing. You must rebuild the Admin UI after the ‘yarn install’, or it is likely that you will use an old UI, whose configuration for content types does not match the content in the database. This can result in tables (content types) and fields ‘disappearing’.

Also, if you run Strapi in ‘development’ mode inside a container, then the whole ‘src’ folder must be made persistent, otherwise any changes that are made - e.g. by creating or editing a content type - will be ‘lost’ next time the container is restarted.

Strapi does not store its schema ‘in the database’ - it stores it in the ‘src’ folder and it ‘freezes’ it for production when you build the Admin UI.

1 Like