非常教程

Docker 17参考手册

引擎: 扩展 | Engine: Extend

插件配置(引擎) | Plugin configuration (Engine)

Plugin V2的插件配置版本1

本文档概述了 V0插件配置的格式。这里描述的插件配置是在v1.12.0版本的 Docker 守护进程中引入的。

插件配置描述了 docker 插件的各种组件。插件配置可以使用以下媒体类型序列化为 JSON 格式:

配置类型

媒体类型

配置

“应用程序/ vnd.docker.plugin.v1 + JSON”

配置字段说明

Config 提供了在注册表中使用 V0插件格式的基本可访问字段。

  • description 插件的字符串描述
  • documentation 字符串 链接到关于插件的文档
  • interface PluginInterface 接口由插件实现,结构由下列字段组成
-  **`types`** _string array_ types indicate what interface(s) the plugin currently implements.
 currently supported:
 
    -  **docker.volumedriver/1.0**
    -  **docker.networkdriver/1.0**
    -  **docker.ipamdriver/1.0**
    -  **docker.authz/1.0**
    -  **docker.logdriver/1.0**
    -  **docker.metricscollector/1.0**
-  **`socket`** _string_ socket is the name of the socket the engine should use to communicate with the plugins. the socket will be created in /run/docker/plugins.
 
  • entrypoint 插件的字符串数组入口点,请参阅ENTRYPOINT
  • workdir 插件的字符串 workdir,请参阅WORKDIR
  • network 插件的 PluginNetwork 网络,结构由以下字段组成
-  **`type`** _string_ network type.
 currently supported:**bridge** - **host** - **none**
  • mounts 插件的 PluginMount 数组装载,结构由以下字段组成,请参阅MOUNTS
-  **`name`** _string_ name of the mount.
 
-  **`description`** _string_ description of the mount.
 
-  **`source`** _string_ source of the mount.
 
-  **`destination`** _string_ destination of the mount.
 
-  **`type`** _string_ mount type.
 
-  **`options`** _string array_ options of the mount.
 
  • ipchost 布尔型访问主机 ipc 命名空间。
  • pidhost 布尔访问主机 pid 名称空间。
  • propagatedMount 字符串 路径作为 rshared 挂载,以便在该路径下挂载对 docker可见。这对于卷插件很有用。这条路径将被绑定到插件 rootfs 的 outisde,所以它的内容在升级时被保留。
  • env 插件的 PluginEnv 数组 env,结构由以下字段组成
-  **`name`** _string_ name of the env.
 
-  **`description`** _string_ description of the env.
 
-  **`value`** _string_ value of the env.
 
  • args PluginArgs 插件的参数,结构由以下字段组成
-  **`name`** _string_ name of the args.
 
-  **`description`** _string_ description of the args.
 
-  **`value`** _string array_ values of the args.
 
  • linux PluginLinux
-  **`capabilities`** _string array_ capabilities of the plugin (Linux only), see list here
 
-  **`allowAllDevices`** _boolean_ If /dev is bind mounted from the host, and allowAllDevices is set to true, the plugin will have rwm access to all devices on the host.
 
-  **`devices`** _PluginDevice array_ device of the plugin, (Linux only), struct consisting of the following fields, see DEVICES
 
    -  **`name`** _string_ name of the device.
 
    -  **`description`** _string_ description of the device.
 
    -  **`path`** _string_ path of the device.
 

示例配置

显示'tiborvass / sample-volume-plugin'插件配置的示例。

{
            "Args": {
                "Description": "",
                "Name": "",
                "Settable": null,
                "Value": null
            },
            "Description": "A sample volume plugin for Docker",
            "Documentation": "https://docs.docker.com/engine/extend/plugins/",
            "Entrypoint": [
                "/usr/bin/sample-volume-plugin",
                "/data"
            ],
            "Env": [
                {
                    "Description": "",
                    "Name": "DEBUG",
                    "Settable": [
                        "value"
                    ],
                    "Value": "0"
                }
            ],
            "Interface": {
                "Socket": "plugin.sock",
                "Types": [
                    "docker.volumedriver/1.0"
                ]
            },
            "Linux": {
                "Capabilities": null,
                "AllowAllDevices": false,
                "Devices": null
            },
            "Mounts": null,
            "Network": {
                "Type": ""
            },
            "PropagatedMount": "/data",
            "User": {},
            "Workdir": ""
}
Docker 17

Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的 Linux 机器上,也可以实现虚拟化。容器是完全使用沙箱机制,相互之间不会有任何接口。

主页 https://docker.com/
源码 https://github.com/docker/docker
版本 17
发布版本 17.06