some more info I used strapi v4.14.4
default DB structre keep remains and new data for those data too, if I create new content type then those will removed upon restart.
This is because you build your docker image at the current state of strapi when you run docker build. (Creating content types happens on the filesystem.) So by restarting you delete all of the newly created content types,which in turn will delete the tables (most likely) on restart.
What is your use case with that setup? As you use yarn develop I suppose it’s development? Any reason you are using docker for strapi instead of local node? If so you need to mount the relevant strapi folders in the container for it to persist.
If you’re trying to use this setup for production. Don’t.
Yes its true that you wont be able to create contentTypes after you used yarn build and yarn start, but thats the point.
if you develop (creating content types etc is developing) on your Prod environment , you can accidentally delete stuff etc, if you misclick.
I would recomment you develop the content types locally, then build a docker image where you run yarn build inside the Dockerfile and use yarn start as an entrypoint (or something along the lines)
then deploy that image to prod. Also make sure to make regular backup of your production Database.
For development that docker-compose file with mounted folders should suffice.
But for production read up a bit (idk if its in the docs , but i guess you’ll find some guidelines somewhere)