filmov
tv
How to Save Docker Data using Bind Mounts or Volumes

Показать описание
Using Docker for a database is common during development. It’s easy to set up, and it’s available for many different types of databases.
One drawback is that the data is not saved when the container is removed.
However, there are two methods that can be used to save data in Docker if a container is removed.
These methods are Volumes and Bind Mounts.
In this video, I’ll explain what they are and show you how to set up a container to use each of them.
We’ll use a MySQL database to demonstrate that the database is saved between containers, but this works on many different databases.
This video assumes you have Docker set up already. If not, you can check out any of my other videos:
Timestamps:
00:00 Introduction
00:16 Docker storage options
01:05 Definitions
01:40 Prerequisites for this video
02:02 Option 1: Create volume
03:00 Docker run with volume
04:35 Add data to database
06:16 Remove and create new container
08:42 Option 2: Create bind mount
09:26 Docker run with bind mount
10:54 Add data to database
11:58 Remove and create new container
Комментарии