Browse code

Add instructions for persisting data Docker-DCO-1.1-Signed-off-by: Benny Ng <benny.tpng@gmail.com> (github: tpng)

tpng authored on 2014/05/21 17:29:24
Showing 1 changed files
... ...
@@ -59,10 +59,34 @@ Let's try the “hello world” example. Run
59 59
 
60 60
 This will download the small busybox image and print hello world.
61 61
 
62
-## Observations
62
+## Persistent storage
63 63
 
64
-### Persistent storage
64
+1. Add a virtual hard drive to the VM created in Installation
65
+2. Start the VM
66
+3. Create an empty partition on the attached virtual hard drive
65 67
 
66
-The virtual machine created above lacks any persistent data storage. All
67
-images and containers will be lost when shutting down or rebooting the
68
-VM.
68
+    ```sh
69
+    sudo fdisk /dev/sda
70
+    n (new partition)
71
+    p (primary partition)
72
+    1 (partition 1)
73
+    w (write changes to disk)
74
+    ```
75
+
76
+4. Format the partition using ext4 
77
+
78
+    ```sh
79
+    mkfs.ext4 -L boot2docker-data /dev/sda1
80
+    ```
81
+
82
+5. Reboot
83
+
84
+    ```sh
85
+    sudo reboot
86
+    ```
87
+
88
+6. boot2docker should now auto mount the partition and persist data there. (/var/lib/docker linking to /mnt/sda1/var/lib/docker)
89
+
90
+    ```sh
91
+    ls -l /var/lib
92
+    ```