github.com/reds/docker@v1.11.2-rc1/experimental/plugins_graphdriver.md (about) 1 # Experimental: Docker graph driver plugins 2 3 Docker graph driver plugins enable admins to use an external/out-of-process 4 graph driver for use with Docker engine. This is an alternative to using the 5 built-in storage drivers, such as aufs/overlay/devicemapper/btrfs. 6 7 A graph driver plugin is used for image and container fs storage, as such 8 the plugin must be started and available for connections prior to Docker Engine 9 being started. 10 11 # Write a graph driver plugin 12 13 See the [plugin documentation](/docs/extend/plugins.md) for detailed information 14 on the underlying plugin protocol. 15 16 17 ## Graph Driver plugin protocol 18 19 If a plugin registers itself as a `GraphDriver` when activated, then it is 20 expected to provide the rootfs for containers as well as image layer storage. 21 22 ### /GraphDriver.Init 23 24 **Request**: 25 ``` 26 { 27 "Home": "/graph/home/path", 28 "Opts": [] 29 } 30 ``` 31 32 Initialize the graph driver plugin with a home directory and array of options. 33 Plugins are not required to accept these options as the Docker Engine does not 34 require that the plugin use this path or options, they are only being passed 35 through from the user. 36 37 **Response**: 38 ``` 39 { 40 "Err": null 41 } 42 ``` 43 44 Respond with a string error if an error occurred. 45 46 47 ### /GraphDriver.Create 48 49 **Request**: 50 ``` 51 { 52 "ID": "46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187", 53 "Parent": "2cd9c322cb78a55e8212aa3ea8425a4180236d7106938ec921d0935a4b8ca142" 54 } 55 ``` 56 57 Create a new, empty, filesystem layer with the specified `ID` and `Parent`. 58 `Parent` may be an empty string, which would indicate that there is no parent 59 layer. 60 61 **Response**: 62 ``` 63 { 64 "Err: null 65 } 66 ``` 67 68 Respond with a string error if an error occurred. 69 70 71 ### /GraphDriver.Remove 72 73 **Request**: 74 ``` 75 { 76 "ID": "46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187" 77 } 78 ``` 79 80 Remove the filesystem layer with this given `ID`. 81 82 **Response**: 83 ``` 84 { 85 "Err: null 86 } 87 ``` 88 89 Respond with a string error if an error occurred. 90 91 ### /GraphDriver.Get 92 93 **Request**: 94 ``` 95 { 96 "ID": "46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187" 97 "MountLabel": "" 98 } 99 ``` 100 101 Get the mountpoint for the layered filesystem referred to by the given `ID`. 102 103 **Response**: 104 ``` 105 { 106 "Dir": "/var/mygraph/46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187", 107 "Err": "" 108 } 109 ``` 110 111 Respond with the absolute path to the mounted layered filesystem. 112 Respond with a string error if an error occurred. 113 114 ### /GraphDriver.Put 115 116 **Request**: 117 ``` 118 { 119 "ID": "46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187" 120 } 121 ``` 122 123 Release the system resources for the specified `ID`, such as unmounting the 124 filesystem layer. 125 126 **Response**: 127 ``` 128 { 129 "Err: null 130 } 131 ``` 132 133 Respond with a string error if an error occurred. 134 135 ### /GraphDriver.Exists 136 137 **Request**: 138 ``` 139 { 140 "ID": "46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187" 141 } 142 ``` 143 144 Determine if a filesystem layer with the specified `ID` exists. 145 146 **Response**: 147 ``` 148 { 149 "Exists": true 150 } 151 ``` 152 153 Respond with a boolean for whether or not the filesystem layer with the specified 154 `ID` exists. 155 156 ### /GraphDriver.Status 157 158 **Request**: 159 ``` 160 {} 161 ``` 162 163 Get low-level diagnostic information about the graph driver. 164 165 **Response**: 166 ``` 167 { 168 "Status": [[]] 169 } 170 ``` 171 172 Respond with a 2-D array with key/value pairs for the underlying status 173 information. 174 175 176 ### /GraphDriver.GetMetadata 177 178 **Request**: 179 ``` 180 { 181 "ID": "46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187" 182 } 183 ``` 184 185 Get low-level diagnostic information about the layered filesystem with the 186 with the specified `ID` 187 188 **Response**: 189 ``` 190 { 191 "Metadata": {}, 192 "Err": null 193 } 194 ``` 195 196 Respond with a set of key/value pairs containing the low-level diagnostic 197 information about the layered filesystem. 198 Respond with a string error if an error occurred. 199 200 ### /GraphDriver.Cleanup 201 202 **Request**: 203 ``` 204 {} 205 ``` 206 207 Perform necessary tasks to release resources help by the plugin, for example 208 unmounting all the layered file systems. 209 210 **Response**: 211 ``` 212 { 213 "Err: null 214 } 215 ``` 216 217 Respond with a string error if an error occurred. 218 219 220 ### /GraphDriver.Diff 221 222 **Request**: 223 ``` 224 { 225 "ID": "46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187", 226 "Parent": "2cd9c322cb78a55e8212aa3ea8425a4180236d7106938ec921d0935a4b8ca142" 227 } 228 ``` 229 230 Get an archive of the changes between the filesystem layers specified by the `ID` 231 and `Parent`. `Parent` may be an empty string, in which case there is no parent. 232 233 **Response**: 234 ``` 235 {{ TAR STREAM }} 236 ``` 237 238 ### /GraphDriver.Changes 239 240 **Request**: 241 ``` 242 { 243 "ID": "46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187", 244 "Parent": "2cd9c322cb78a55e8212aa3ea8425a4180236d7106938ec921d0935a4b8ca142" 245 } 246 ``` 247 248 Get a list of changes between the filesystem layers specified by the `ID` and 249 `Parent`. `Parent` may be an empty string, in which case there is no parent. 250 251 **Response**: 252 ``` 253 { 254 "Changes": [{}], 255 "Err": null 256 } 257 ``` 258 259 Responds with a list of changes. The structure of a change is: 260 ``` 261 "Path": "/some/path", 262 "Kind": 0, 263 ``` 264 265 Where the `Path` is the filesystem path within the layered filesystem that is 266 changed and `Kind` is an integer specifying the type of change that occurred: 267 268 - 0 - Modified 269 - 1 - Added 270 - 2 - Deleted 271 272 Respond with a string error if an error occurred. 273 274 ### /GraphDriver.ApplyDiff 275 276 **Request**: 277 ``` 278 {{ TAR STREAM }} 279 ``` 280 281 Extract the changeset from the given diff into the layer with the specified `ID` 282 and `Parent` 283 284 **Query Parameters**: 285 286 - id (required)- the `ID` of the new filesystem layer to extract the diff to 287 - parent (required)- the `Parent` of the given `ID` 288 289 **Response**: 290 ``` 291 { 292 "Size": 512366, 293 "Err": null 294 } 295 ``` 296 297 Respond with the size of the new layer in bytes. 298 Respond with a string error if an error occurred. 299 300 ### /GraphDriver.DiffSize 301 302 **Request**: 303 ``` 304 { 305 "ID": "46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187", 306 "Parent": "2cd9c322cb78a55e8212aa3ea8425a4180236d7106938ec921d0935a4b8ca142" 307 } 308 ``` 309 310 Calculate the changes between the specified `ID` 311 312 **Response**: 313 ``` 314 { 315 "Size": 512366, 316 "Err": null 317 } 318 ``` 319 320 Respond with the size changes between the specified `ID` and `Parent` 321 Respond with a string error if an error occurred.