Movatterモバイル変換


[0]ホーム

URL:


plugins

package
v2.0.0-beta.5Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2025 License:Apache-2.0Imports:22Imported by:0

Details

Repository

github.com/moby/moby

Links

Documentation

Overview

Package plugins provides structures and helper functions to manage Dockerplugins.

Docker discovers plugins by looking for them in the plugin directory whenevera user or container tries to use one by name. UNIX domain socket files mustbe located under /run/docker/plugins, whereas spec files can be locatedeither under /etc/docker/plugins or /usr/lib/docker/plugins. This is handledby the Registry interface, which lets you list all plugins or get a plugin byits name if it exists.

The plugins need to implement an HTTP server and bind this to the UNIX socketor the address specified in the spec files.A handshake is send at /Plugin.Activate, and plugins are expected to returna Manifest with a list of Docker subsystems which this plugin implements.

In order to use a plugins, you can use the `Get` with the name of theplugin and the subsystem it implements.

plugin, err := plugins.Get("example", "VolumeDriver")if err != nil {return fmt.Errorf("Error looking up volume plugin example: %v", err)}

Index

Constants

View Source
const ProtocolSchemeHTTPV1 = "moby.plugins.http/v1"

ProtocolSchemeHTTPV1 is the name of the protocol used for interacting with plugins using this package.

View Source
const VersionMimetype =transport.VersionMimetype

VersionMimetype is the Content-Type the engine sends to plugins.

Variables

View Source
var ErrNotFound =errors.New("plugin not found")

ErrNotFound plugin not found

View Source
var ErrNotImplements =errors.New("Plugin does not implement the requested driver")

ErrNotImplements is returned if the plugin does not implement the requested driver.

Functions

funcHandle

func Handle(ifacestring, fn func(string, *Client))

Handle adds the specified function to the extpointHandlers.

funcIsNotFound

func IsNotFound(errerror)bool

IsNotFound indicates if the passed in error is from an http.StatusNotFound from the plugin

funcSpecsPaths

func SpecsPaths() []string

SpecsPaths returns paths in which to look for plugins, in order of priority.

On Windows:

  • "%programdata%\docker\plugins"

On Unix in non-rootless mode:

  • "/etc/docker/plugins"
  • "/usr/lib/docker/plugins"

On Unix in rootless-mode:

  • "$XDG_CONFIG_HOME/docker/plugins" (or "/etc/docker/plugins" if $XDG_CONFIG_HOME is not set)
  • "$HOME/.local/lib/docker/plugins" (pr "/usr/lib/docker/plugins" if $HOME is set)

funcWithRequestTimeout

func WithRequestTimeout(ttime.Duration) func(*RequestOpts)

WithRequestTimeout sets a timeout duration for plugin requests

Types

typeClient

type Client struct {// contains filtered or unexported fields}

Client represents a plugin client.

funcNewClient

func NewClient(addrstring, tlsConfig *tlsconfig.Options) (*Client,error)

NewClient creates a new plugin client (http).

funcNewClientWithTimeout

func NewClientWithTimeout(addrstring, tlsConfig *tlsconfig.Options, timeouttime.Duration) (*Client,error)

NewClientWithTimeout creates a new plugin client (http).

func (*Client)Call

func (c *Client) Call(serviceMethodstring, args, retany)error

Call calls the specified method with the specified arguments for the plugin.It will retry for 30 seconds if a failure occurs when calling.

func (*Client)CallWithOptions

func (c *Client) CallWithOptions(serviceMethodstring, argsany, retany, opts ...func(*RequestOpts))error

CallWithOptions is just like call except it takes options

func (*Client)SendFile

func (c *Client) SendFile(serviceMethodstring, dataio.Reader, retany)error

SendFile calls the specified method, and passes through the IO stream

func (*Client)Stream

func (c *Client) Stream(serviceMethodstring, argsany) (io.ReadCloser,error)

Stream calls the specified method with the specified arguments for the plugin and returns the response body

typeLocalRegistry

type LocalRegistry struct {// contains filtered or unexported fields}

LocalRegistry defines a registry that is local (using unix socket).

funcNewLocalRegistry

func NewLocalRegistry()LocalRegistry

func (*LocalRegistry)GetAll

func (l *LocalRegistry) GetAll(impstring) ([]*Plugin,error)

GetAll returns all the plugins for the specified implementation

func (*LocalRegistry)Plugin

func (l *LocalRegistry) Plugin(namestring) (*Plugin,error)

Plugin returns the plugin registered with the given name (or returns an error).

func (*LocalRegistry)Scan

func (l *LocalRegistry) Scan() ([]string,error)

Scan scans all the plugin paths and returns all the names it found

typeManifest

type Manifest struct {// List of subsystem the plugin implements.Implements []string}

Manifest lists what a plugin implements.

typePlugin

type Plugin struct {// Address of the pluginAddrstring// TLS configuration of the pluginTLSConfig *tlsconfig.Options// Manifest of the plugin (see above)Manifest *Manifest `json:"-"`// contains filtered or unexported fields}

Plugin is the definition of a docker plugin.

funcGet

func Get(name, impstring) (*Plugin,error)

Get returns the plugin given the specified name and requested implementation.

funcNewLocalPlugin

func NewLocalPlugin(name, addrstring) *Plugin

NewLocalPlugin creates a new local plugin.

func (*Plugin)Client

func (p *Plugin) Client() *Client

Client returns a ready-to-use plugin client that can be used to communicate with the plugin.

func (*Plugin)IsV1

func (p *Plugin) IsV1()bool

IsV1 returns true for V1 plugins and false otherwise.

func (*Plugin)Name

func (p *Plugin) Name()string

Name returns the name of the plugin.

func (*Plugin)Protocol

func (p *Plugin) Protocol()string

Protocol returns the protocol name/version used for plugins in this package.

func (*Plugin)ScopedPath

func (p *Plugin) ScopedPath(sstring)string

ScopedPath returns the path scoped to the plugin's rootfs.For v1 plugins, this always returns the path unchanged as v1 plugins run directly on the host.

typeRequestOpts

type RequestOpts struct {Timeouttime.Duration// contains filtered or unexported fields}

RequestOpts is the set of options that can be passed into a request

Source Files

View all Source files

Directories

PathSynopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp