What is the best way in a developer environment to create a persist database container that can have its data persist between reboots? Using docker compose.
1 Like
this would be a volume this would be a the “-v” option
docker compose would require a YML file
Thank you for your quick reply. I want to see if I could create this setup using docker compose. What would be the correct syntax within compose’s YML file to have a volume persist to the host?
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