github.com/flavio/docker@v0.1.3-0.20170117145210-f63d1a6eec47/docs/extend/plugins_graphdriver.md (about) 1 --- 2 title: "Graphdriver plugins" 3 description: "How to manage image and container filesystems with external plugins" 4 keywords: "Examples, Usage, storage, image, docker, data, graph, plugin, api" 5 advisory: experimental 6 --- 7 8 <!-- This file is maintained within the docker/docker Github 9 repository at https://github.com/docker/docker/. Make all 10 pull requests against that repo. If you see this file in 11 another repository, consider it read-only there, as it will 12 periodically be overwritten by the definitive file. Pull 13 requests which include edits to this file in other repositories 14 will be rejected. 15 --> 16 17 18 ## Changelog 19 20 ### 1.13.0 21 22 - Support v2 plugins 23 24 # Docker graph driver plugins 25 26 Docker graph driver plugins enable admins to use an external/out-of-process 27 graph driver for use with Docker engine. This is an alternative to using the 28 built-in storage drivers, such as aufs/overlay/devicemapper/btrfs. 29 30 You need to install and enable the plugin and then restart the Docker daemon 31 before using the plugin. See the following example for the correct ordering 32 of steps. 33 34 ``` 35 $ docker plugin install cpuguy83/docker-overlay2-graphdriver-plugin # this command also enables the driver 36 <output supressed> 37 $ pkill dockerd 38 $ dockerd --experimental -s cpuguy83/docker-overlay2-graphdriver-plugin 39 ``` 40 41 # Write a graph driver plugin 42 43 See the [plugin documentation](https://docs.docker.com/engine/extend/) for detailed information 44 on the underlying plugin protocol. 45 46 47 ## Graph Driver plugin protocol 48 49 If a plugin registers itself as a `GraphDriver` when activated, then it is 50 expected to provide the rootfs for containers as well as image layer storage. 51 52 ### /GraphDriver.Init 53 54 **Request**: 55 ```json 56 { 57 "Home": "/graph/home/path", 58 "Opts": [], 59 "UIDMaps": [], 60 "GIDMaps": [] 61 } 62 ``` 63 64 Initialize the graph driver plugin with a home directory and array of options. 65 These are passed through from the user, but the plugin is not required to parse 66 or honor them. 67 68 The request also includes a list of UID and GID mappings, structed as follows: 69 ```json 70 { 71 "ContainerID": 0, 72 "HostID": 0, 73 "Size": 0 74 } 75 ``` 76 77 **Response**: 78 ```json 79 { 80 "Err": "" 81 } 82 ``` 83 84 Respond with a non-empty string error if an error occurred. 85 86 87 ### /GraphDriver.Create 88 89 **Request**: 90 ```json 91 { 92 "ID": "46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187", 93 "Parent": "2cd9c322cb78a55e8212aa3ea8425a4180236d7106938ec921d0935a4b8ca142", 94 "MountLabel": "", 95 "StorageOpt": {} 96 } 97 ``` 98 99 Create a new, empty, read-only filesystem layer with the specified 100 `ID`, `Parent` and `MountLabel`. If `Parent` is an empty string, there is no 101 parent layer. `StorageOpt` is map of strings which indicate storage options. 102 103 **Response**: 104 ```json 105 { 106 "Err": "" 107 } 108 ``` 109 110 Respond with a non-empty string error if an error occurred. 111 112 ### /GraphDriver.CreateReadWrite 113 114 **Request**: 115 ```json 116 { 117 "ID": "46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187", 118 "Parent": "2cd9c322cb78a55e8212aa3ea8425a4180236d7106938ec921d0935a4b8ca142", 119 "MountLabel": "", 120 "StorageOpt": {} 121 } 122 ``` 123 124 Similar to `/GraphDriver.Create` but creates a read-write filesystem layer. 125 126 ### /GraphDriver.Remove 127 128 **Request**: 129 ```json 130 { 131 "ID": "46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187" 132 } 133 ``` 134 135 Remove the filesystem layer with this given `ID`. 136 137 **Response**: 138 ```json 139 { 140 "Err": "" 141 } 142 ``` 143 144 Respond with a non-empty string error if an error occurred. 145 146 ### /GraphDriver.Get 147 148 **Request**: 149 ```json 150 { 151 "ID": "46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187", 152 "MountLabel": "" 153 } 154 ``` 155 156 Get the mountpoint for the layered filesystem referred to by the given `ID`. 157 158 **Response**: 159 ```json 160 { 161 "Dir": "/var/mygraph/46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187", 162 "Err": "" 163 } 164 ``` 165 166 Respond with the absolute path to the mounted layered filesystem. 167 Respond with a non-empty string error if an error occurred. 168 169 ### /GraphDriver.Put 170 171 **Request**: 172 ```json 173 { 174 "ID": "46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187" 175 } 176 ``` 177 178 Release the system resources for the specified `ID`, such as unmounting the 179 filesystem layer. 180 181 **Response**: 182 ```json 183 { 184 "Err": "" 185 } 186 ``` 187 188 Respond with a non-empty string error if an error occurred. 189 190 ### /GraphDriver.Exists 191 192 **Request**: 193 ```json 194 { 195 "ID": "46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187" 196 } 197 ``` 198 199 Determine if a filesystem layer with the specified `ID` exists. 200 201 **Response**: 202 ```json 203 { 204 "Exists": true 205 } 206 ``` 207 208 Respond with a boolean for whether or not the filesystem layer with the specified 209 `ID` exists. 210 211 ### /GraphDriver.Status 212 213 **Request**: 214 ```json 215 {} 216 ``` 217 218 Get low-level diagnostic information about the graph driver. 219 220 **Response**: 221 ```json 222 { 223 "Status": [[]] 224 } 225 ``` 226 227 Respond with a 2-D array with key/value pairs for the underlying status 228 information. 229 230 231 ### /GraphDriver.GetMetadata 232 233 **Request**: 234 ```json 235 { 236 "ID": "46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187" 237 } 238 ``` 239 240 Get low-level diagnostic information about the layered filesystem with the 241 with the specified `ID` 242 243 **Response**: 244 ```json 245 { 246 "Metadata": {}, 247 "Err": "" 248 } 249 ``` 250 251 Respond with a set of key/value pairs containing the low-level diagnostic 252 information about the layered filesystem. 253 Respond with a non-empty string error if an error occurred. 254 255 ### /GraphDriver.Cleanup 256 257 **Request**: 258 ```json 259 {} 260 ``` 261 262 Perform necessary tasks to release resources help by the plugin, such as 263 unmounting all the layered file systems. 264 265 **Response**: 266 ```json 267 { 268 "Err": "" 269 } 270 ``` 271 272 Respond with a non-empty string error if an error occurred. 273 274 275 ### /GraphDriver.Diff 276 277 **Request**: 278 ```json 279 { 280 "ID": "46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187", 281 "Parent": "2cd9c322cb78a55e8212aa3ea8425a4180236d7106938ec921d0935a4b8ca142" 282 } 283 ``` 284 285 Get an archive of the changes between the filesystem layers specified by the `ID` 286 and `Parent`. `Parent` may be an empty string, in which case there is no parent. 287 288 **Response**: 289 ``` 290 {{ TAR STREAM }} 291 ``` 292 293 ### /GraphDriver.Changes 294 295 **Request**: 296 ```json 297 { 298 "ID": "46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187", 299 "Parent": "2cd9c322cb78a55e8212aa3ea8425a4180236d7106938ec921d0935a4b8ca142" 300 } 301 ``` 302 303 Get a list of changes between the filesystem layers specified by the `ID` and 304 `Parent`. If `Parent` is an empty string, there is no parent. 305 306 **Response**: 307 ```json 308 { 309 "Changes": [{}], 310 "Err": "" 311 } 312 ``` 313 314 Respond with a list of changes. The structure of a change is: 315 ```json 316 "Path": "/some/path", 317 "Kind": 0, 318 ``` 319 320 Where the `Path` is the filesystem path within the layered filesystem that is 321 changed and `Kind` is an integer specifying the type of change that occurred: 322 323 - 0 - Modified 324 - 1 - Added 325 - 2 - Deleted 326 327 Respond with a non-empty string error if an error occurred. 328 329 ### /GraphDriver.ApplyDiff 330 331 **Request**: 332 ``` 333 {{ TAR STREAM }} 334 ``` 335 336 Extract the changeset from the given diff into the layer with the specified `ID` 337 and `Parent` 338 339 **Query Parameters**: 340 341 - id (required)- the `ID` of the new filesystem layer to extract the diff to 342 - parent (required)- the `Parent` of the given `ID` 343 344 **Response**: 345 ```json 346 { 347 "Size": 512366, 348 "Err": "" 349 } 350 ``` 351 352 Respond with the size of the new layer in bytes. 353 Respond with a non-empty string error if an error occurred. 354 355 ### /GraphDriver.DiffSize 356 357 **Request**: 358 ```json 359 { 360 "ID": "46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187", 361 "Parent": "2cd9c322cb78a55e8212aa3ea8425a4180236d7106938ec921d0935a4b8ca142" 362 } 363 ``` 364 365 Calculate the changes between the specified `ID` 366 367 **Response**: 368 ```json 369 { 370 "Size": 512366, 371 "Err": "" 372 } 373 ``` 374 375 Respond with the size changes between the specified `ID` and `Parent` 376 Respond with a non-empty string error if an error occurred.