github.com/yogeshlonkar/moby@v1.13.2-0.20201203103638-c0b64beaea94/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](/docs/extend/index.md) 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  {% raw %}
   291  {{ TAR STREAM }}
   292  {% endraw %}
   293  ```
   294  
   295  ### /GraphDriver.Changes
   296  
   297  **Request**:
   298  ```json
   299  {
   300    "ID": "46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187",
   301    "Parent": "2cd9c322cb78a55e8212aa3ea8425a4180236d7106938ec921d0935a4b8ca142"
   302  }
   303  ```
   304  
   305  Get a list of changes between the filesystem layers specified by the `ID` and
   306  `Parent`. If `Parent` is an empty string, there is no parent.
   307  
   308  **Response**:
   309  ```json
   310  {
   311    "Changes": [{}],
   312    "Err": ""
   313  }
   314  ```
   315  
   316  Respond with a list of changes. The structure of a change is:
   317  ```json
   318    "Path": "/some/path",
   319    "Kind": 0,
   320  ```
   321  
   322  Where the `Path` is the filesystem path within the layered filesystem that is
   323  changed and `Kind` is an integer specifying the type of change that occurred:
   324  
   325  - 0 - Modified
   326  - 1 - Added
   327  - 2 - Deleted
   328  
   329  Respond with a non-empty string error if an error occurred.
   330  
   331  ### /GraphDriver.ApplyDiff
   332  
   333  **Request**:
   334  ```
   335  {% raw %}
   336  {{ TAR STREAM }}
   337  {% endraw %}
   338  ```
   339  
   340  Extract the changeset from the given diff into the layer with the specified `ID`
   341  and `Parent`
   342  
   343  **Query Parameters**:
   344  
   345  - id (required)- the `ID` of the new filesystem layer to extract the diff to
   346  - parent (required)- the `Parent` of the given `ID`
   347  
   348  **Response**:
   349  ```json
   350  {
   351    "Size": 512366,
   352    "Err": ""
   353  }
   354  ```
   355  
   356  Respond with the size of the new layer in bytes.
   357  Respond with a non-empty string error if an error occurred.
   358  
   359  ### /GraphDriver.DiffSize
   360  
   361  **Request**:
   362  ```json
   363  {
   364    "ID": "46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187",
   365    "Parent": "2cd9c322cb78a55e8212aa3ea8425a4180236d7106938ec921d0935a4b8ca142"
   366  }
   367  ```
   368  
   369  Calculate the changes between the specified `ID`
   370  
   371  **Response**:
   372  ```json
   373  {
   374    "Size": 512366,
   375    "Err": ""
   376  }
   377  ```
   378  
   379  Respond with the size changes between the specified `ID` and `Parent`
   380  Respond with a non-empty string error if an error occurred.