github.com/zhuohuang-hust/src-cbuild@v0.0.0-20230105071821-c7aab3e7c840/docs/extend/config.md (about)

     1  ---
     2  title: "Plugin config"
     3  description: "How develop and use a plugin with the managed plugin system"
     4  keywords: "API, Usage, plugins, documentation, developer"
     5  ---
     6  
     7  <!-- This file is maintained within the docker/docker Github
     8       repository at https://github.com/docker/docker/. Make all
     9       pull requests against that repo. If you see this file in
    10       another repository, consider it read-only there, as it will
    11       periodically be overwritten by the definitive file. Pull
    12       requests which include edits to this file in other repositories
    13       will be rejected.
    14  -->
    15  
    16  
    17  # Plugin Config Version 0 of Plugin V2
    18  
    19  This document outlines the format of the V0 plugin configuration. The plugin
    20  config described herein was introduced in the Docker daemon in the [v1.12.0
    21  release](https://github.com/docker/docker/commit/f37117045c5398fd3dca8016ea8ca0cb47e7312b).
    22  
    23  Plugin configs describe the various constituents of a docker plugin. Plugin
    24  configs can be serialized to JSON format with the following media types:
    25  
    26  Config Type  | Media Type
    27  ------------- | -------------
    28  config  | "application/vnd.docker.plugin.v0+json"
    29  
    30  
    31  ## *Config* Field Descriptions
    32  
    33  Config provides the base accessible fields for working with V0 plugin format
    34   in the registry.
    35  
    36  - **`description`** *string*
    37  
    38  	description of the plugin
    39  
    40  - **`documentation`** *string*
    41  
    42    	link to the documentation about the plugin
    43  
    44  - **`interface`** *PluginInterface*
    45  
    46     interface implemented by the plugins, struct consisting of the following fields
    47  
    48      - **`types`** *string array*
    49  
    50        types indicate what interface(s) the plugin currently implements.
    51  
    52        currently supported:
    53  
    54        	- **docker.volumedriver/1.0**
    55  
    56        	- **docker.authz/1.0**
    57  
    58      - **`socket`** *string*
    59  
    60        socket is the name of the socket the engine should use to communicate with the plugins.
    61        the socket will be created in `/run/docker/plugins`.
    62  
    63  
    64  - **`entrypoint`** *string array*
    65  
    66     entrypoint of the plugin, see [`ENTRYPOINT`](../reference/builder.md#entrypoint)
    67  
    68  - **`workdir`** *string*
    69  
    70     workdir of the plugin, see [`WORKDIR`](../reference/builder.md#workdir)
    71  
    72  - **`network`** *PluginNetwork*
    73  
    74     network of the plugin, struct consisting of the following fields
    75  
    76      - **`type`** *string*
    77  
    78        network type.
    79  
    80        currently supported:
    81  
    82        	- **bridge**
    83        	- **host**
    84        	- **none**
    85  
    86  - **`mounts`** *PluginMount array*
    87  
    88     mount of the plugin, struct consisting of the following fields, see [`MOUNTS`](https://github.com/opencontainers/runtime-spec/blob/master/config.md#mounts)
    89  
    90      - **`name`** *string*
    91  
    92  	  name of the mount.
    93  
    94      - **`description`** *string*
    95  
    96        description of the mount.
    97  
    98      - **`source`** *string*
    99  
   100  	  source of the mount.
   101  
   102      - **`destination`** *string*
   103  
   104  	  destination of the mount.
   105  
   106      - **`type`** *string*
   107  
   108        mount type.
   109  
   110      - **`options`** *string array*
   111  
   112  	  options of the mount.
   113  
   114  - **`env`** *PluginEnv array*
   115  
   116     env of the plugin, struct consisting of the following fields
   117  
   118      - **`name`** *string*
   119  
   120  	  name of the env.
   121  
   122      - **`description`** *string*
   123  
   124        description of the env.
   125  
   126      - **`value`** *string*
   127  
   128  	  value of the env.
   129  
   130  - **`args`** *PluginArgs*
   131  
   132     args of the plugin, struct consisting of the following fields
   133  
   134      - **`name`** *string*
   135  
   136  	  name of the env.
   137  
   138      - **`description`** *string*
   139  
   140        description of the env.
   141  
   142      - **`value`** *string array*
   143  
   144  	  values of the args.
   145  
   146  - **`linux`** *PluginLinux*
   147  
   148      - **`capabilities`** *string array*
   149  
   150            capabilities of the plugin (*Linux only*), see list [`here`](https://github.com/opencontainers/runc/blob/master/libcontainer/SPEC.md#security)
   151  
   152      - **`devices`** *PluginDevice array*
   153  
   154            device of the plugin, (*Linux only*), struct consisting of the following fields, see [`DEVICES`](https://github.com/opencontainers/runtime-spec/blob/master/config-linux.md#devices)
   155  
   156            - **`name`** *string*
   157  
   158  	      name of the device.
   159  
   160            - **`description`** *string*
   161  
   162                description of the device.
   163  
   164            - **`path`** *string*
   165  
   166                path of the device.
   167  
   168  ## Example Config
   169  
   170  *Example showing the 'tiborvass/no-remove' plugin config.*
   171  
   172  ```json
   173  {
   174    "description": "A test plugin for Docker",
   175    "documentation": "https://docs.docker.com/engine/extend/plugins/",
   176    "entrypoint": ["plugin-no-remove", "/data"],
   177    "interface": {
   178      "types": ["docker.volumedriver/1.0"],
   179      "socket": "plugins.sock"
   180    },
   181    "network": {
   182      "type": "host"
   183    },
   184    "mounts": [
   185      {
   186        "source": "/data",
   187        "destination": "/data",
   188        "type": "bind",
   189        "options": ["shared", "rbind"]
   190      },
   191      {
   192        "destination": "/foobar",
   193        "type": "tmpfs"
   194      }
   195    ],
   196    "args": {
   197      "name": "args",
   198      "description": "command line arguments",
   199      "value": []
   200    },
   201    "env": [
   202      {
   203        "name": "DEBUG",
   204        "description": "If set, prints debug messages",
   205        "value": "1"
   206      }
   207    ],
   208    "linux": {
   209      "devices": [
   210        {
   211          "name": "device",
   212          "description": "a host device to mount",
   213          "path": "/dev/cpu_dma_latency"
   214        }
   215      ]
   216    }
   217  }
   218  ```