2016-11-19 11:41:07 -05:00
|
|
|
---
|
|
|
|
title: "Graphdriver plugins"
|
|
|
|
description: "How to manage image and container filesystems with external plugins"
|
|
|
|
keywords: "Examples, Usage, storage, image, docker, data, graph, plugin, api"
|
|
|
|
advisory: experimental
|
|
|
|
---
|
|
|
|
|
2017-10-04 13:03:55 -04:00
|
|
|
<!-- This file is maintained within the docker/cli GitHub
|
2017-07-28 13:28:23 -04:00
|
|
|
repository at https://github.com/docker/cli/. Make all
|
2016-11-19 11:41:07 -05:00
|
|
|
pull requests against that repo. If you see this file in
|
|
|
|
another repository, consider it read-only there, as it will
|
|
|
|
periodically be overwritten by the definitive file. Pull
|
|
|
|
requests which include edits to this file in other repositories
|
|
|
|
will be rejected.
|
|
|
|
-->
|
|
|
|
|
|
|
|
|
|
|
|
## Changelog
|
|
|
|
|
|
|
|
### 1.13.0
|
|
|
|
|
|
|
|
- Support v2 plugins
|
|
|
|
|
|
|
|
# Docker graph driver plugins
|
2015-06-05 16:09:53 -04:00
|
|
|
|
|
|
|
Docker graph driver plugins enable admins to use an external/out-of-process
|
|
|
|
graph driver for use with Docker engine. This is an alternative to using the
|
|
|
|
built-in storage drivers, such as aufs/overlay/devicemapper/btrfs.
|
|
|
|
|
2016-11-19 11:41:07 -05:00
|
|
|
You need to install and enable the plugin and then restart the Docker daemon
|
|
|
|
before using the plugin. See the following example for the correct ordering
|
|
|
|
of steps.
|
|
|
|
|
|
|
|
```
|
|
|
|
$ docker plugin install cpuguy83/docker-overlay2-graphdriver-plugin # this command also enables the driver
|
2017-01-19 02:29:28 -05:00
|
|
|
<output suppressed>
|
2016-11-19 11:41:07 -05:00
|
|
|
$ pkill dockerd
|
|
|
|
$ dockerd --experimental -s cpuguy83/docker-overlay2-graphdriver-plugin
|
|
|
|
```
|
2015-06-05 16:09:53 -04:00
|
|
|
|
|
|
|
# Write a graph driver plugin
|
|
|
|
|
2016-11-29 08:04:03 -05:00
|
|
|
See the [plugin documentation](https://docs.docker.com/engine/extend/) for detailed information
|
2015-06-05 16:09:53 -04:00
|
|
|
on the underlying plugin protocol.
|
|
|
|
|
|
|
|
|
|
|
|
## Graph Driver plugin protocol
|
|
|
|
|
|
|
|
If a plugin registers itself as a `GraphDriver` when activated, then it is
|
|
|
|
expected to provide the rootfs for containers as well as image layer storage.
|
|
|
|
|
|
|
|
### /GraphDriver.Init
|
|
|
|
|
|
|
|
**Request**:
|
2016-11-19 11:41:07 -05:00
|
|
|
```json
|
2015-06-05 16:09:53 -04:00
|
|
|
{
|
|
|
|
"Home": "/graph/home/path",
|
2016-11-19 11:41:07 -05:00
|
|
|
"Opts": [],
|
|
|
|
"UIDMaps": [],
|
|
|
|
"GIDMaps": []
|
2015-06-05 16:09:53 -04:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Initialize the graph driver plugin with a home directory and array of options.
|
2016-11-19 11:41:07 -05:00
|
|
|
These are passed through from the user, but the plugin is not required to parse
|
|
|
|
or honor them.
|
2015-06-05 16:09:53 -04:00
|
|
|
|
2016-11-19 11:41:07 -05:00
|
|
|
The request also includes a list of UID and GID mappings, structed as follows:
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"ContainerID": 0,
|
|
|
|
"HostID": 0,
|
|
|
|
"Size": 0
|
|
|
|
}
|
2015-06-05 16:09:53 -04:00
|
|
|
```
|
2016-11-19 11:41:07 -05:00
|
|
|
|
|
|
|
**Response**:
|
|
|
|
```json
|
2015-06-05 16:09:53 -04:00
|
|
|
{
|
2016-04-13 13:11:39 -04:00
|
|
|
"Err": ""
|
2015-06-05 16:09:53 -04:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2016-04-13 13:11:39 -04:00
|
|
|
Respond with a non-empty string error if an error occurred.
|
2015-06-05 16:09:53 -04:00
|
|
|
|
|
|
|
|
2017-03-20 14:38:17 -04:00
|
|
|
### /GraphDriver.Capabilities
|
|
|
|
|
|
|
|
**Request**:
|
|
|
|
```json
|
|
|
|
{}
|
|
|
|
```
|
|
|
|
|
|
|
|
Get behavioral characteristics of the graph driver. If a plugin does not handle
|
|
|
|
this request, the engine will use default values for all capabilities.
|
|
|
|
|
|
|
|
**Response**:
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"ReproducesExactDiffs": false,
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Respond with values of capabilities:
|
|
|
|
|
|
|
|
* **ReproducesExactDiffs** Defaults to false. Flags that this driver is capable
|
|
|
|
of reproducing exactly equivalent diffs for read-only filesystem layers.
|
|
|
|
|
|
|
|
|
2015-06-05 16:09:53 -04:00
|
|
|
### /GraphDriver.Create
|
|
|
|
|
|
|
|
**Request**:
|
2016-11-19 11:41:07 -05:00
|
|
|
```json
|
2015-06-05 16:09:53 -04:00
|
|
|
{
|
|
|
|
"ID": "46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187",
|
2016-11-19 11:41:07 -05:00
|
|
|
"Parent": "2cd9c322cb78a55e8212aa3ea8425a4180236d7106938ec921d0935a4b8ca142",
|
|
|
|
"MountLabel": "",
|
|
|
|
"StorageOpt": {}
|
2015-06-05 16:09:53 -04:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2016-04-13 13:11:39 -04:00
|
|
|
Create a new, empty, read-only filesystem layer with the specified
|
2016-11-19 11:41:07 -05:00
|
|
|
`ID`, `Parent` and `MountLabel`. If `Parent` is an empty string, there is no
|
|
|
|
parent layer. `StorageOpt` is map of strings which indicate storage options.
|
2015-06-05 16:09:53 -04:00
|
|
|
|
|
|
|
**Response**:
|
2016-11-19 11:41:07 -05:00
|
|
|
```json
|
2015-06-05 16:09:53 -04:00
|
|
|
{
|
2016-04-13 13:11:39 -04:00
|
|
|
"Err": ""
|
2015-06-05 16:09:53 -04:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2016-04-13 13:11:39 -04:00
|
|
|
Respond with a non-empty string error if an error occurred.
|
|
|
|
|
|
|
|
### /GraphDriver.CreateReadWrite
|
|
|
|
|
|
|
|
**Request**:
|
2016-11-19 11:41:07 -05:00
|
|
|
```json
|
2016-04-13 13:11:39 -04:00
|
|
|
{
|
|
|
|
"ID": "46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187",
|
2016-11-19 11:41:07 -05:00
|
|
|
"Parent": "2cd9c322cb78a55e8212aa3ea8425a4180236d7106938ec921d0935a4b8ca142",
|
|
|
|
"MountLabel": "",
|
|
|
|
"StorageOpt": {}
|
2016-04-13 13:11:39 -04:00
|
|
|
}
|
|
|
|
```
|
2015-06-05 16:09:53 -04:00
|
|
|
|
2016-04-13 13:11:39 -04:00
|
|
|
Similar to `/GraphDriver.Create` but creates a read-write filesystem layer.
|
2015-06-05 16:09:53 -04:00
|
|
|
|
|
|
|
### /GraphDriver.Remove
|
|
|
|
|
|
|
|
**Request**:
|
2016-11-19 11:41:07 -05:00
|
|
|
```json
|
2015-06-05 16:09:53 -04:00
|
|
|
{
|
|
|
|
"ID": "46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Remove the filesystem layer with this given `ID`.
|
|
|
|
|
|
|
|
**Response**:
|
2016-11-19 11:41:07 -05:00
|
|
|
```json
|
2015-06-05 16:09:53 -04:00
|
|
|
{
|
2016-04-13 13:11:39 -04:00
|
|
|
"Err": ""
|
2015-06-05 16:09:53 -04:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2016-04-13 13:11:39 -04:00
|
|
|
Respond with a non-empty string error if an error occurred.
|
2015-06-05 16:09:53 -04:00
|
|
|
|
|
|
|
### /GraphDriver.Get
|
|
|
|
|
|
|
|
**Request**:
|
2016-11-19 11:41:07 -05:00
|
|
|
```json
|
2015-06-05 16:09:53 -04:00
|
|
|
{
|
2016-11-19 11:41:07 -05:00
|
|
|
"ID": "46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187",
|
2015-06-05 16:09:53 -04:00
|
|
|
"MountLabel": ""
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Get the mountpoint for the layered filesystem referred to by the given `ID`.
|
|
|
|
|
|
|
|
**Response**:
|
2016-11-19 11:41:07 -05:00
|
|
|
```json
|
2015-06-05 16:09:53 -04:00
|
|
|
{
|
|
|
|
"Dir": "/var/mygraph/46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187",
|
|
|
|
"Err": ""
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Respond with the absolute path to the mounted layered filesystem.
|
2016-04-13 13:11:39 -04:00
|
|
|
Respond with a non-empty string error if an error occurred.
|
2015-06-05 16:09:53 -04:00
|
|
|
|
|
|
|
### /GraphDriver.Put
|
|
|
|
|
|
|
|
**Request**:
|
2016-11-19 11:41:07 -05:00
|
|
|
```json
|
2015-06-05 16:09:53 -04:00
|
|
|
{
|
|
|
|
"ID": "46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Release the system resources for the specified `ID`, such as unmounting the
|
|
|
|
filesystem layer.
|
|
|
|
|
|
|
|
**Response**:
|
2016-11-19 11:41:07 -05:00
|
|
|
```json
|
2015-06-05 16:09:53 -04:00
|
|
|
{
|
2016-04-13 13:11:39 -04:00
|
|
|
"Err": ""
|
2015-06-05 16:09:53 -04:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2016-04-13 13:11:39 -04:00
|
|
|
Respond with a non-empty string error if an error occurred.
|
2015-06-05 16:09:53 -04:00
|
|
|
|
|
|
|
### /GraphDriver.Exists
|
|
|
|
|
|
|
|
**Request**:
|
2016-11-19 11:41:07 -05:00
|
|
|
```json
|
2015-06-05 16:09:53 -04:00
|
|
|
{
|
|
|
|
"ID": "46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Determine if a filesystem layer with the specified `ID` exists.
|
|
|
|
|
|
|
|
**Response**:
|
2016-11-19 11:41:07 -05:00
|
|
|
```json
|
2015-06-05 16:09:53 -04:00
|
|
|
{
|
|
|
|
"Exists": true
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Respond with a boolean for whether or not the filesystem layer with the specified
|
|
|
|
`ID` exists.
|
|
|
|
|
|
|
|
### /GraphDriver.Status
|
|
|
|
|
|
|
|
**Request**:
|
2016-11-19 11:41:07 -05:00
|
|
|
```json
|
2015-06-05 16:09:53 -04:00
|
|
|
{}
|
|
|
|
```
|
|
|
|
|
|
|
|
Get low-level diagnostic information about the graph driver.
|
|
|
|
|
|
|
|
**Response**:
|
2016-11-19 11:41:07 -05:00
|
|
|
```json
|
2015-06-05 16:09:53 -04:00
|
|
|
{
|
|
|
|
"Status": [[]]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Respond with a 2-D array with key/value pairs for the underlying status
|
|
|
|
information.
|
|
|
|
|
|
|
|
|
|
|
|
### /GraphDriver.GetMetadata
|
|
|
|
|
|
|
|
**Request**:
|
2016-11-19 11:41:07 -05:00
|
|
|
```json
|
2015-06-05 16:09:53 -04:00
|
|
|
{
|
|
|
|
"ID": "46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Get low-level diagnostic information about the layered filesystem with the
|
|
|
|
with the specified `ID`
|
|
|
|
|
|
|
|
**Response**:
|
2016-11-19 11:41:07 -05:00
|
|
|
```json
|
2015-06-05 16:09:53 -04:00
|
|
|
{
|
|
|
|
"Metadata": {},
|
2016-04-13 13:11:39 -04:00
|
|
|
"Err": ""
|
2015-06-05 16:09:53 -04:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Respond with a set of key/value pairs containing the low-level diagnostic
|
|
|
|
information about the layered filesystem.
|
2016-04-13 13:11:39 -04:00
|
|
|
Respond with a non-empty string error if an error occurred.
|
2015-06-05 16:09:53 -04:00
|
|
|
|
|
|
|
### /GraphDriver.Cleanup
|
|
|
|
|
|
|
|
**Request**:
|
2016-11-19 11:41:07 -05:00
|
|
|
```json
|
2015-06-05 16:09:53 -04:00
|
|
|
{}
|
|
|
|
```
|
|
|
|
|
2016-11-19 11:41:07 -05:00
|
|
|
Perform necessary tasks to release resources help by the plugin, such as
|
2015-06-05 16:09:53 -04:00
|
|
|
unmounting all the layered file systems.
|
|
|
|
|
|
|
|
**Response**:
|
2016-11-19 11:41:07 -05:00
|
|
|
```json
|
2015-06-05 16:09:53 -04:00
|
|
|
{
|
2016-04-13 13:11:39 -04:00
|
|
|
"Err": ""
|
2015-06-05 16:09:53 -04:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2016-04-13 13:11:39 -04:00
|
|
|
Respond with a non-empty string error if an error occurred.
|
2015-06-05 16:09:53 -04:00
|
|
|
|
|
|
|
|
|
|
|
### /GraphDriver.Diff
|
|
|
|
|
|
|
|
**Request**:
|
2016-11-19 11:41:07 -05:00
|
|
|
```json
|
2015-06-05 16:09:53 -04:00
|
|
|
{
|
|
|
|
"ID": "46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187",
|
|
|
|
"Parent": "2cd9c322cb78a55e8212aa3ea8425a4180236d7106938ec921d0935a4b8ca142"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Get an archive of the changes between the filesystem layers specified by the `ID`
|
|
|
|
and `Parent`. `Parent` may be an empty string, in which case there is no parent.
|
|
|
|
|
|
|
|
**Response**:
|
|
|
|
```
|
2017-02-14 19:40:15 -05:00
|
|
|
{% raw %}
|
2015-06-05 16:09:53 -04:00
|
|
|
{{ TAR STREAM }}
|
2017-02-14 19:40:15 -05:00
|
|
|
{% endraw %}
|
2015-06-05 16:09:53 -04:00
|
|
|
```
|
|
|
|
|
|
|
|
### /GraphDriver.Changes
|
|
|
|
|
|
|
|
**Request**:
|
2016-11-19 11:41:07 -05:00
|
|
|
```json
|
2015-06-05 16:09:53 -04:00
|
|
|
{
|
|
|
|
"ID": "46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187",
|
|
|
|
"Parent": "2cd9c322cb78a55e8212aa3ea8425a4180236d7106938ec921d0935a4b8ca142"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Get a list of changes between the filesystem layers specified by the `ID` and
|
2016-11-19 11:41:07 -05:00
|
|
|
`Parent`. If `Parent` is an empty string, there is no parent.
|
2015-06-05 16:09:53 -04:00
|
|
|
|
|
|
|
**Response**:
|
2016-11-19 11:41:07 -05:00
|
|
|
```json
|
2015-06-05 16:09:53 -04:00
|
|
|
{
|
|
|
|
"Changes": [{}],
|
2016-04-13 13:11:39 -04:00
|
|
|
"Err": ""
|
2015-06-05 16:09:53 -04:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2016-11-15 04:15:26 -05:00
|
|
|
Respond with a list of changes. The structure of a change is:
|
2016-11-19 11:41:07 -05:00
|
|
|
```json
|
2015-06-05 16:09:53 -04:00
|
|
|
"Path": "/some/path",
|
|
|
|
"Kind": 0,
|
|
|
|
```
|
|
|
|
|
2016-01-15 21:27:59 -05:00
|
|
|
Where the `Path` is the filesystem path within the layered filesystem that is
|
2015-06-05 16:09:53 -04:00
|
|
|
changed and `Kind` is an integer specifying the type of change that occurred:
|
|
|
|
|
|
|
|
- 0 - Modified
|
|
|
|
- 1 - Added
|
|
|
|
- 2 - Deleted
|
|
|
|
|
2016-04-13 13:11:39 -04:00
|
|
|
Respond with a non-empty string error if an error occurred.
|
2015-06-05 16:09:53 -04:00
|
|
|
|
|
|
|
### /GraphDriver.ApplyDiff
|
|
|
|
|
|
|
|
**Request**:
|
|
|
|
```
|
2017-02-14 19:40:15 -05:00
|
|
|
{% raw %}
|
2015-06-05 16:09:53 -04:00
|
|
|
{{ TAR STREAM }}
|
2017-02-14 19:40:15 -05:00
|
|
|
{% endraw %}
|
2015-06-05 16:09:53 -04:00
|
|
|
```
|
|
|
|
|
|
|
|
Extract the changeset from the given diff into the layer with the specified `ID`
|
|
|
|
and `Parent`
|
|
|
|
|
|
|
|
**Query Parameters**:
|
|
|
|
|
|
|
|
- id (required)- the `ID` of the new filesystem layer to extract the diff to
|
|
|
|
- parent (required)- the `Parent` of the given `ID`
|
|
|
|
|
|
|
|
**Response**:
|
2016-11-19 11:41:07 -05:00
|
|
|
```json
|
2015-06-05 16:09:53 -04:00
|
|
|
{
|
|
|
|
"Size": 512366,
|
2016-04-13 13:11:39 -04:00
|
|
|
"Err": ""
|
2015-06-05 16:09:53 -04:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Respond with the size of the new layer in bytes.
|
2016-04-13 13:11:39 -04:00
|
|
|
Respond with a non-empty string error if an error occurred.
|
2015-06-05 16:09:53 -04:00
|
|
|
|
|
|
|
### /GraphDriver.DiffSize
|
|
|
|
|
|
|
|
**Request**:
|
2016-11-19 11:41:07 -05:00
|
|
|
```json
|
2015-06-05 16:09:53 -04:00
|
|
|
{
|
|
|
|
"ID": "46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187",
|
|
|
|
"Parent": "2cd9c322cb78a55e8212aa3ea8425a4180236d7106938ec921d0935a4b8ca142"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Calculate the changes between the specified `ID`
|
|
|
|
|
|
|
|
**Response**:
|
2016-11-19 11:41:07 -05:00
|
|
|
```json
|
2015-06-05 16:09:53 -04:00
|
|
|
{
|
|
|
|
"Size": 512366,
|
2016-04-13 13:11:39 -04:00
|
|
|
"Err": ""
|
2015-06-05 16:09:53 -04:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Respond with the size changes between the specified `ID` and `Parent`
|
2016-04-13 13:11:39 -04:00
|
|
|
Respond with a non-empty string error if an error occurred.
|