...

Text file src/github.com/docker/cli/docs/reference/commandline/plugin_set.md

Documentation: github.com/docker/cli/docs/reference/commandline

     1# plugin set
     2
     3<!---MARKER_GEN_START-->
     4Change settings for a plugin
     5
     6
     7<!---MARKER_GEN_END-->
     8
     9## Description
    10
    11Change settings for a plugin. The plugin must be disabled.
    12
    13The settings currently supported are:
    14 * env variables
    15 * source of mounts
    16 * path of devices
    17 * args
    18
    19## What is settable ?
    20
    21Look at the plugin manifest, it's easy to see what fields are settable,
    22by looking at the `Settable` field.
    23
    24Here is an extract of a plugin manifest:
    25
    26```json
    27{
    28  "config": {
    29    "args": {
    30      "name": "myargs",
    31      "settable": ["value"],
    32      "value": ["foo", "bar"]
    33    },
    34    "env": [
    35      {
    36        "name": "DEBUG",
    37        "settable": ["value"],
    38        "value": "0"
    39      },
    40      {
    41        "name": "LOGGING",
    42        "value": "1"
    43      }
    44    ],
    45    "devices": [
    46      {
    47        "name": "mydevice",
    48        "path": "/dev/foo",
    49        "settable": ["path"]
    50      }
    51    ],
    52    "mounts": [
    53      {
    54        "destination": "/baz",
    55        "name": "mymount",
    56        "options": ["rbind"],
    57        "settable": ["source"],
    58        "source": "/foo",
    59        "type": "bind"
    60      }
    61    ]
    62  }
    63}
    64```
    65
    66In this example, we can see that the `value` of the `DEBUG` environment variable is settable,
    67the `source` of the `mymount` mount is also settable. Same for the `path` of `mydevice` and `value` of `myargs`.
    68
    69On the contrary, the `LOGGING` environment variable doesn't have any settable field, which implies that user cannot tweak it.
    70
    71## Examples
    72
    73### Change an environment variable
    74
    75The following example change the env variable `DEBUG` on the
    76`sample-volume-plugin` plugin.
    77
    78```console
    79$ docker plugin inspect -f {{.Settings.Env}} tiborvass/sample-volume-plugin
    80[DEBUG=0]
    81
    82$ docker plugin set tiborvass/sample-volume-plugin DEBUG=1
    83
    84$ docker plugin inspect -f {{.Settings.Env}} tiborvass/sample-volume-plugin
    85[DEBUG=1]
    86```
    87
    88### Change the source of a mount
    89
    90The following example change the source of the `mymount` mount on
    91the `myplugin` plugin.
    92
    93```console
    94$ docker plugin inspect -f '{{with $mount := index .Settings.Mounts 0}}{{$mount.Source}}{{end}}' myplugin
    95/foo
    96
    97$ docker plugins set myplugin mymount.source=/bar
    98
    99$ docker plugin inspect -f '{{with $mount := index .Settings.Mounts 0}}{{$mount.Source}}{{end}}' myplugin
   100/bar
   101```
   102
   103> **Note**
   104>
   105> Since only `source` is settable in `mymount`,
   106> `docker plugins set mymount=/bar myplugin` would work too.
   107
   108### Change a device path
   109
   110The following example change the path of the `mydevice` device on
   111the `myplugin` plugin.
   112
   113```console
   114$ docker plugin inspect -f '{{with $device := index .Settings.Devices 0}}{{$device.Path}}{{end}}' myplugin
   115
   116/dev/foo
   117
   118$ docker plugins set myplugin mydevice.path=/dev/bar
   119
   120$ docker plugin inspect -f '{{with $device := index .Settings.Devices 0}}{{$device.Path}}{{end}}' myplugin
   121
   122/dev/bar
   123```
   124
   125> **Note**
   126>
   127> Since only `path` is settable in `mydevice`,
   128> `docker plugins set mydevice=/dev/bar myplugin` would work too.
   129
   130### Change the source of the arguments
   131
   132The following example change the value of the args on the `myplugin` plugin.
   133
   134```console
   135$ docker plugin inspect -f '{{.Settings.Args}}' myplugin
   136
   137["foo", "bar"]
   138
   139$ docker plugins set myplugin myargs="foo bar baz"
   140
   141$ docker plugin inspect -f '{{.Settings.Args}}' myplugin
   142
   143["foo", "bar", "baz"]
   144```
   145
   146## Related commands
   147
   148* [plugin create](plugin_create.md)
   149* [plugin disable](plugin_disable.md)
   150* [plugin enable](plugin_enable.md)
   151* [plugin inspect](plugin_inspect.md)
   152* [plugin install](plugin_install.md)
   153* [plugin ls](plugin_ls.md)
   154* [plugin push](plugin_push.md)
   155* [plugin rm](plugin_rm.md)
   156* [plugin upgrade](plugin_upgrade.md)

View as plain text