github.com/uppal0016/docker_new@v0.0.0-20240123060250-1c98be13ac2c/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": ""
    41  }
    42  ```
    43  
    44  Respond with a non-empty string error if an error occurred.
    45  
    46  
    47  ### /GraphDriver.Create
    48  
    49  **Request**:
    50  ```
    51  {
    52    "ID": "46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187",
    53    "Parent": "2cd9c322cb78a55e8212aa3ea8425a4180236d7106938ec921d0935a4b8ca142"
    54    "MountLabel": ""
    55  }
    56  ```
    57  
    58  Create a new, empty, read-only filesystem layer with the specified
    59  `ID`, `Parent` and `MountLabel`. `Parent` may be an empty string,
    60  which would indicate that there is no parent layer.
    61  
    62  **Response**:
    63  ```
    64  {
    65    "Err": ""
    66  }
    67  ```
    68  
    69  Respond with a non-empty string error if an error occurred.
    70  
    71  ### /GraphDriver.CreateReadWrite
    72  
    73  **Request**:
    74  ```
    75  {
    76    "ID": "46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187",
    77    "Parent": "2cd9c322cb78a55e8212aa3ea8425a4180236d7106938ec921d0935a4b8ca142"
    78    "MountLabel": ""
    79  }
    80  ```
    81  
    82  Similar to `/GraphDriver.Create` but creates a read-write filesystem layer.
    83  
    84  ### /GraphDriver.Remove
    85  
    86  **Request**:
    87  ```
    88  {
    89    "ID": "46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187"
    90  }
    91  ```
    92  
    93  Remove the filesystem layer with this given `ID`.
    94  
    95  **Response**:
    96  ```
    97  {
    98    "Err": ""
    99  }
   100  ```
   101  
   102  Respond with a non-empty string error if an error occurred.
   103  
   104  ### /GraphDriver.Get
   105  
   106  **Request**:
   107  ```
   108  {
   109    "ID": "46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187"
   110    "MountLabel": ""
   111  }
   112  ```
   113  
   114  Get the mountpoint for the layered filesystem referred to by the given `ID`.
   115  
   116  **Response**:
   117  ```
   118  {
   119    "Dir": "/var/mygraph/46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187",
   120    "Err": ""
   121  }
   122  ```
   123  
   124  Respond with the absolute path to the mounted layered filesystem.
   125  Respond with a non-empty string error if an error occurred.
   126  
   127  ### /GraphDriver.Put
   128  
   129  **Request**:
   130  ```
   131  {
   132    "ID": "46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187"
   133  }
   134  ```
   135  
   136  Release the system resources for the specified `ID`, such as unmounting the
   137  filesystem layer.
   138  
   139  **Response**:
   140  ```
   141  {
   142    "Err": ""
   143  }
   144  ```
   145  
   146  Respond with a non-empty string error if an error occurred.
   147  
   148  ### /GraphDriver.Exists
   149  
   150  **Request**:
   151  ```
   152  {
   153    "ID": "46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187"
   154  }
   155  ```
   156  
   157  Determine if a filesystem layer with the specified `ID` exists.
   158  
   159  **Response**:
   160  ```
   161  {
   162    "Exists": true
   163  }
   164  ```
   165  
   166  Respond with a boolean for whether or not the filesystem layer with the specified
   167  `ID` exists.
   168  
   169  ### /GraphDriver.Status
   170  
   171  **Request**:
   172  ```
   173  {}
   174  ```
   175  
   176  Get low-level diagnostic information about the graph driver.
   177  
   178  **Response**:
   179  ```
   180  {
   181    "Status": [[]]
   182  }
   183  ```
   184  
   185  Respond with a 2-D array with key/value pairs for the underlying status
   186  information.
   187  
   188  
   189  ### /GraphDriver.GetMetadata
   190  
   191  **Request**:
   192  ```
   193  {
   194    "ID": "46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187"
   195  }
   196  ```
   197  
   198  Get low-level diagnostic information about the layered filesystem with the
   199  with the specified `ID`
   200  
   201  **Response**:
   202  ```
   203  {
   204    "Metadata": {},
   205    "Err": ""
   206  }
   207  ```
   208  
   209  Respond with a set of key/value pairs containing the low-level diagnostic
   210  information about the layered filesystem.
   211  Respond with a non-empty string error if an error occurred.
   212  
   213  ### /GraphDriver.Cleanup
   214  
   215  **Request**:
   216  ```
   217  {}
   218  ```
   219  
   220  Perform necessary tasks to release resources help by the plugin, for example
   221  unmounting all the layered file systems.
   222  
   223  **Response**:
   224  ```
   225  {
   226    "Err": ""
   227  }
   228  ```
   229  
   230  Respond with a non-empty string error if an error occurred.
   231  
   232  
   233  ### /GraphDriver.Diff
   234  
   235  **Request**:
   236  ```
   237  {
   238    "ID": "46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187",
   239    "Parent": "2cd9c322cb78a55e8212aa3ea8425a4180236d7106938ec921d0935a4b8ca142"
   240  }
   241  ```
   242  
   243  Get an archive of the changes between the filesystem layers specified by the `ID`
   244  and `Parent`. `Parent` may be an empty string, in which case there is no parent.
   245  
   246  **Response**:
   247  ```
   248  {{ TAR STREAM }}
   249  ```
   250  
   251  ### /GraphDriver.Changes
   252  
   253  **Request**:
   254  ```
   255  {
   256    "ID": "46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187",
   257    "Parent": "2cd9c322cb78a55e8212aa3ea8425a4180236d7106938ec921d0935a4b8ca142"
   258  }
   259  ```
   260  
   261  Get a list of changes between the filesystem layers specified by the `ID` and
   262  `Parent`. `Parent` may be an empty string, in which case there is no parent.
   263  
   264  **Response**:
   265  ```
   266  {
   267    "Changes": [{}],
   268    "Err": ""
   269  }
   270  ```
   271  
   272  Responds with a list of changes. The structure of a change is:
   273  ```
   274    "Path": "/some/path",
   275    "Kind": 0,
   276  ```
   277  
   278  Where the `Path` is the filesystem path within the layered filesystem that is
   279  changed and `Kind` is an integer specifying the type of change that occurred:
   280  
   281  - 0 - Modified
   282  - 1 - Added
   283  - 2 - Deleted
   284  
   285  Respond with a non-empty string error if an error occurred.
   286  
   287  ### /GraphDriver.ApplyDiff
   288  
   289  **Request**:
   290  ```
   291  {{ TAR STREAM }}
   292  ```
   293  
   294  Extract the changeset from the given diff into the layer with the specified `ID`
   295  and `Parent`
   296  
   297  **Query Parameters**:
   298  
   299  - id (required)- the `ID` of the new filesystem layer to extract the diff to
   300  - parent (required)- the `Parent` of the given `ID`
   301  
   302  **Response**:
   303  ```
   304  {
   305    "Size": 512366,
   306    "Err": ""
   307  }
   308  ```
   309  
   310  Respond with the size of the new layer in bytes.
   311  Respond with a non-empty string error if an error occurred.
   312  
   313  ### /GraphDriver.DiffSize
   314  
   315  **Request**:
   316  ```
   317  {
   318    "ID": "46fe8644f2572fd1e505364f7581e0c9dbc7f14640bd1fb6ce97714fb6fc5187",
   319    "Parent": "2cd9c322cb78a55e8212aa3ea8425a4180236d7106938ec921d0935a4b8ca142"
   320  }
   321  ```
   322  
   323  Calculate the changes between the specified `ID`
   324  
   325  **Response**:
   326  ```
   327  {
   328    "Size": 512366,
   329    "Err": ""
   330  }
   331  ```
   332  
   333  Respond with the size changes between the specified `ID` and `Parent`
   334  Respond with a non-empty string error if an error occurred.