What is the best way to create persist database container?

Please try the below docker compose file for data persists sample


web:
build: .
command: bin/rails server --port 3000 --binding 0.0.0.0
ports:
- "3000:3000"
links:
- db
volumes:
- .:/myapp
volumes_from:
- bundle

bundle:
image: myapp_web
command: echo I’m a little data container, short and stout…
volumes:
- /bundle