Documentation
¶
Overview ¶
Package docker is the in-process Docker adapter: it materializes `container` resources on the Docker daemon named by DOCKER_HOST.
Package docker provides the first-party Docker adapter. Plugin wraps *Adapter as a plugin.Adapter so it can run as a separate binary.
Index ¶
- type API
- type Adapter
- type Fake
- func (f *Fake) ContainerCreate(_ context.Context, o client.ContainerCreateOptions) (client.ContainerCreateResult, error)
- func (f *Fake) ContainerInspect(_ context.Context, name string, _ client.ContainerInspectOptions) (client.ContainerInspectResult, error)
- func (f *Fake) ContainerRemove(_ context.Context, name string, _ client.ContainerRemoveOptions) (client.ContainerRemoveResult, error)
- func (f *Fake) ContainerStart(_ context.Context, name string, _ client.ContainerStartOptions) (client.ContainerStartResult, error)
- func (f *Fake) ContainerStop(_ context.Context, name string, _ client.ContainerStopOptions) (client.ContainerStopResult, error)
- func (f *Fake) ContainerUpdate(_ context.Context, name string, o client.ContainerUpdateOptions) (client.ContainerUpdateResult, error)
- func (f *Fake) ImageInspect(_ context.Context, ref string, _ ...client.ImageInspectOption) (client.ImageInspectResult, error)
- func (f *Fake) ImagePull(_ context.Context, ref string, _ client.ImagePullOptions) (client.ImagePullResponse, error)
- type FakeContainer
- type Plugin
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API interface {
ImageInspect(ctx context.Context, ref string, opts ...client.ImageInspectOption) (client.ImageInspectResult, error)
ImagePull(ctx context.Context, ref string, opts client.ImagePullOptions) (client.ImagePullResponse, error)
ContainerCreate(ctx context.Context, opts client.ContainerCreateOptions) (client.ContainerCreateResult, error)
ContainerStart(ctx context.Context, name string, opts client.ContainerStartOptions) (client.ContainerStartResult, error)
ContainerStop(ctx context.Context, name string, opts client.ContainerStopOptions) (client.ContainerStopResult, error)
ContainerRemove(ctx context.Context, name string, opts client.ContainerRemoveOptions) (client.ContainerRemoveResult, error)
ContainerInspect(ctx context.Context, name string, opts client.ContainerInspectOptions) (client.ContainerInspectResult, error)
ContainerUpdate(ctx context.Context, name string, opts client.ContainerUpdateOptions) (client.ContainerUpdateResult, error)
}
API is the subset of the Docker client the adapter uses. *client.Client satisfies it; Fake implements it for tests.
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter creates, updates, and deletes containers through an API. Containers are addressed by resource name, never by stored id.
func New ¶
New returns an Adapter for the daemon named by DOCKER_HOST (default: the local socket). No connection is made until the first call.
func (*Adapter) Create ¶
func (a *Adapter) Create(ctx context.Context, name, typ string, props map[string]any, report plugin.Reporter) (map[string]any, error)
Create materializes resource name and returns its outputs ({"id": ...}).
func (*Adapter) Delete ¶
Delete removes container name. A free name, or one held by a container dex did not create, counts as deleted and is left alone.
func (*Adapter) Update ¶
func (a *Adapter) Update(ctx context.Context, name string, desired, cur map[string]any, report plugin.Reporter) (map[string]any, error)
Update moves container name from properties cur to desired. A change to restart alone is applied in place; anything else replaces the container, pulling the new image first so a failed pull leaves the old one running.
type Fake ¶
type Fake struct {
Images map[string]bool
Containers map[string]*FakeContainer
Err map[string]error
CrashOnStart bool // started containers exit immediately with code 1
Calls []string // method names, in call order
// contains filtered or unexported fields
}
Fake is an in-memory API: a minimal daemon holding images and named containers, for tests of this package and of its callers. Set Err[method] (e.g. Err["ContainerStart"]) to make that method fail.
func (*Fake) ContainerCreate ¶
func (f *Fake) ContainerCreate(_ context.Context, o client.ContainerCreateOptions) (client.ContainerCreateResult, error)
func (*Fake) ContainerInspect ¶
func (f *Fake) ContainerInspect(_ context.Context, name string, _ client.ContainerInspectOptions) (client.ContainerInspectResult, error)
func (*Fake) ContainerRemove ¶
func (f *Fake) ContainerRemove(_ context.Context, name string, _ client.ContainerRemoveOptions) (client.ContainerRemoveResult, error)
func (*Fake) ContainerStart ¶
func (f *Fake) ContainerStart(_ context.Context, name string, _ client.ContainerStartOptions) (client.ContainerStartResult, error)
func (*Fake) ContainerStop ¶
func (f *Fake) ContainerStop(_ context.Context, name string, _ client.ContainerStopOptions) (client.ContainerStopResult, error)
func (*Fake) ContainerUpdate ¶
func (f *Fake) ContainerUpdate(_ context.Context, name string, o client.ContainerUpdateOptions) (client.ContainerUpdateResult, error)
func (*Fake) ImageInspect ¶
func (f *Fake) ImageInspect(_ context.Context, ref string, _ ...client.ImageInspectOption) (client.ImageInspectResult, error)
type FakeContainer ¶
type FakeContainer struct {
ID string
Config *container.Config
HostConfig *container.HostConfig
Running bool
ExitCode int
}
FakeContainer is one container held by Fake, keyed by name.
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin wraps *Adapter to implement plugin.Adapter, bridging the in-process docker.Adapter interface to the gRPC-facing plugin.Adapter interface.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
dex-adapter-docker
command
dex-adapter-docker is the gRPC adapter binary for Docker containers.
|
dex-adapter-docker is the gRPC adapter binary for Docker containers. |