DOCKER Data Persistence | Volumes, Bind and tmpfs Mounts
Vložit
- čas přidán 2. 06. 2024
- In this video we'll be focusing on data persistence, which is crucial for ensuring that your data remains safe and accessible throughout the lifecycle of your containers.
⏰ Timestamp:
00:00 - Intro
00:48 - Data Persistence in Docker
02:21 - How can we overcome these challenges?
04:40 - Method 1: Docker Volumes
06:11 - Method 1 DEMO: Data loss without using a Docker Volume
14:18 - Method 1 DEMO: Data persistence using a Docker Volume
22:42 - Method 1: Categories
25:22 - Recommendations for Environments
26:24 - Method 2: Bind Mounts
26:54 - Method 2 DEMO: Creating a Bind Mount
33:36 - Method 3: Docker tmpfs Mounts
34:29 - Method 3 DEMO: Using Docker tmpfs Mounts
41:40 - Table of Comparision
42:21- Summary
🔗 Links for Demos:
Docker Volumes: github.com/mili-sucevic/hitc-...
Bind Mounts: github.com/mili-sucevic/hitc-...
tmpfs Mounts: github.com/mili-sucevic/hitc-...
🌐 Stay Connected:
Discord Community: / discord
Medium: / headinthecloudsonline
Instagram: / headintheclouds.online
🎶 Downtown Walk by | e s c p | www.escp.space
escp-music.bandcamp.com - Věda a technologie
Q. So what's the difference between "Host" volumes and Bind Mount ?
Thank you for sharing your knowledge. It is helping me a lot. Especially the practical examples and use cases.
That’s a great question, thanks for your comment! 🙌🏻
Host volumes are managed by Docker and stored in a dedicated location on the host such as ‘/var/lib/docker/volumes/’. They’re easier to use and more portable since Docker handles their creation and management.
Bind mount volumes on the other hand directly map a specific host directory to a directory in the container. This gives more control and flexibility, which is useful for development or when you need direct access to the files on the host.
In a nutshell: host volumes are best for general persistence, while bind mounts are ideal for situations like having a specific host paths.
You are very welcome! We’re here to grow together 🌱☺️
It looks like the best place to store things like connection strings for external databases and configuration is in a "Bind Mount", is that correct?
Thanks for your message! ☺️ Using a bind mount might seem convenient, however it's not the most secure option out there. Instead, consider leveraging Docker secrets or env variables to keep your data safe and sound 🔐