1DOCKER-LVM-PLUGIN(8) FEBRUARY 2016 DOCKER-LVM-PLUGIN(8)
2
3
4
6 docker-lvm-plugin - Docker Volume Driver for lvm volumes
7
8
9
11 docker-lvm-plugin [-debug] [-version]
12
13
14
16 This plugin can be used to create lvm volumes of specified size, which
17 can then be bind mounted into the container using docker run command.
18
19
20
22 Start the docker daemon before starting the docker-lvm-plugin daemon.
23 You can start docker daemon using command:
24
25
26 systemctl start docker
27
28
29
30 Once docker daemon is up and running, you can start docker-lvm-plugin
31 daemon using command:
32
33
34 systemctl start docker-lvm-plugin
35
36
37
38 docker-lvm-plugin daemon is on-demand socket activated. Running docker
39 volume ls command will automatically start the daemon.
40
41
42 Since logical volumes (lv's) are based on a volume group, it is the
43 responsibility of the user (administrator) to provide a volume group
44 name. You can choose an existing volume group name by listing volume
45 groups on your system using vgs command OR create a new volume group
46 using vgcreate command. e.g.
47
48
49 vgcreate vg1 /dev/hda
50
51
52
53 where /dev/hda is your partition or whole disk on which physical
54 volumes were created.
55
56
57 Add this volume group name in the config file.
58
59
60 /etc/docker/docker-lvm-plugin
61
62
63
64 The docker-lvm-plugin also supports the creation of thinly-provisioned
65 volumes. To create a thinly-provisioned volume, a user (administrator)
66 must first create a thin pool using the lvcreate command.
67
68
69 lvcreate -L 10G -T vg1/mythinpool
70
71
72
73 This will create a thinpool named mythinpool of size 10G under volume
74 group vg1. NOTE: thinpools are special kind of logical volumes carved
75 out of the volume group. Hence in the above example, to create the
76 thinpool mythinpool you must have atleast 10G of freespace in volume
77 group vg1.
78
79
80
82 -debug=true|false
83 Enable debug logging. Default is false. -version=true|false
84 Print version information and quit. Default is false.
85
86
87
89 Volume Creation
90
91
92 docker volume create -d lvm --opt size=0.2G --name foobar
93
94
95
96 This will create a lvm volume named foobar of size 208 MB (0.2 GB).
97
98
99 docker volume create -d lvm --opt size=0.2G --opt thinpool=mythinpool --name thin_vol
100
101
102
103 This will create a thinly-provisioned lvm volume named thin_vol in
104 mythinpool.
105
106
107 docker volume create -d lvm --opt snapshot=foobar --opt size=100M --name foobar_snapshot
108
109
110
111 This will create a snapshot volume of foobar named foobar_snapshot. For
112 thin snapshots, use the same command above but don't specify a size.
113
114
115 docker volume create -d lvm --opt size=0.2G --opt keyfile=/root/key.bin --name crypt_vol
116
117
118
119 This will create a LUKS encrypted lvm volume named crypt_vol with the
120 contents of /root/key.bin as a binary passphrase. Snapshots of
121 encrypted volumes use the same key file. The key file must be present
122 when the volume is created, and when it is mounted to a container.
123
124
125 Volume List
126
127
128 docker volume ls
129
130
131
132 This will list volumes created by all docker drivers including the
133 default driver (local).
134
135
136 Volume Inspect
137
138
139 docker volume inspect foobar
140
141
142
143 This will inspect foobar and return a JSON. [
144 {
145 "Driver": "lvm",
146 "Labels": {},
147 "Mountpoint": "/var/lib/docker-lvm-plugin/foobar",
148 "Name": "foobar",
149 "Options": {
150 "size": "0.2G"
151 },
152 "Scope": "local"
153 } ]
154
155
156 Volume Removal
157
158
159 docker volume rm foobar
160
161
162
163 This will remove lvm volume foobar.
164
165
166 Bind Mount lvm volume inside the container
167
168
169 docker run -it -v foobar:/home fedora /bin/bash
170
171
172
173 This will bind mount the logical volume foobar into the home directory
174 of the container.
175
176
177
178Shishir Mahajan DOCKER-LVM-PLUGIN(8)