File tree Expand file tree Collapse file tree 3 files changed +35
-0
lines changed Expand file tree Collapse file tree 3 files changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ ## Volumes vs bind mounts
2
+ * bind mounts rely on the file system structure of the host
3
+ * You need to manage them
4
+ * The container has access to the files on the Docker host
5
+ * Volumes are managed by Docker
6
+ * Independent of the file system structure on the host
7
+ * Easy to migrate and backup
8
+ * Can be managed via the Docker client
9
+ * Can be pre-populated with data from a container
Original file line number Diff line number Diff line change
1
+ ## When to use what?
2
+ ### bind mount
3
+ * When you want to access the data from the host and the container
4
+ * source code
5
+ * configuration files
6
+
7
+ ### Volume
8
+ * When you want to persist data from the container
9
+ * When you want to share data between containers
10
+ * backups
11
+ * configuration
Original file line number Diff line number Diff line change
1
+ ## Named vs anonymous volumes
2
+ ### Named Volume
3
+ * You care about the data long-term
4
+ * A database
5
+ * Other services that persist data
6
+ * You need to easily identify the volume
7
+ * Reuse them
8
+ * For backups
9
+ * Migrate them
10
+
11
+ ### Anonymous Volume
12
+ * You don't care about the data long-term
13
+ * Testing
14
+ * When you need to share data between containers
15
+ * using --volumes-from
You can’t perform that action at this time.
0 commit comments