Documentation
¶
Overview ¶
Package daemon wires the engine together: the image store, the root filesystems built from it, and the container manager. The API server is a thin HTTP face over it.
Index ¶
- Variables
- func ExecConfig(img *image.Image) image.ExecConfig
- func ParseBind(b string) (container.Mount, error)
- type CreateRequest
- type Daemon
- func (d *Daemon) Close(ctx context.Context) error
- func (d *Daemon) Containers() *container.Manager
- func (d *Daemon) CreateContainer(req CreateRequest) (*container.Container, error)
- func (d *Daemon) CreateVolume(name string, labels map[string]string) (*volume.Volume, error)
- func (d *Daemon) DiskUsage() (DiskUsage, error)
- func (d *Daemon) Events() *events.Bus
- func (d *Daemon) Images() ([]ImageInfo, error)
- func (d *Daemon) NetworkRemove(ref string) error
- func (d *Daemon) Networks() *network.Manager
- func (d *Daemon) PruneImages(all bool) ([]DeleteItem, int64, error)
- func (d *Daemon) PruneVolumes(all bool) ([]string, int64)
- func (d *Daemon) Pull(ctx context.Context, ref string, progress image.Progress) (string, *image.PullResult, error)
- func (d *Daemon) RemoveImage(ref string, force bool) ([]DeleteItem, error)
- func (d *Daemon) RemoveVolume(name string, force bool) error
- func (d *Daemon) ResolveImage(ref string) (string, *image.Image, error)
- func (d *Daemon) Restored() container.RestoreReport
- func (d *Daemon) Storage() StorageInfo
- func (d *Daemon) Volumes() *volume.Manager
- type DeleteItem
- type DiskUsage
- type ImageInfo
- type Options
- type StorageInfo
Constants ¶
This section is empty.
Variables ¶
var ErrImageInUse = errors.New("image is being used by a container")
ErrImageInUse is returned when removing an image a container uses.
var ErrNoSuchImage = errors.New("no such image")
ErrNoSuchImage is returned for an unknown image reference.
Functions ¶
func ExecConfig ¶
func ExecConfig(img *image.Image) image.ExecConfig
ExecConfig returns the run configuration an image declares. A wasm artifact has none; its single module is the entrypoint.
Types ¶
type CreateRequest ¶
type CreateRequest struct {
Name string
Image string
Entrypoint []string // nil = image's
Cmd []string // nil = image's
Env []string
WorkingDir string
Labels map[string]string
Memory int64
AutoRemove bool
// Binds are "VOLUME:/path[:ro|:rw]": named volumes only (a host path
// means nothing to a WebAssembly engine), created if missing.
Binds []string
// Network is the network to join by name or ID ("" or "default": the
// engine's default; "none": no network).
Network string
}
CreateRequest is a container create, with Docker's override rules: a set Entrypoint replaces the image's and drops its Cmd; a set Cmd replaces the image's Cmd; Env entries override the image's by key.
type Daemon ¶
type Daemon struct {
// contains filtered or unexported fields
}
Daemon is one engine instance.
func (*Daemon) Containers ¶
Containers is the container manager.
func (*Daemon) CreateContainer ¶
func (d *Daemon) CreateContainer(req CreateRequest) (*container.Container, error)
CreateContainer makes a container from an image.
func (*Daemon) CreateVolume ¶ added in v0.8.0
CreateVolume makes a volume (or returns the existing one).
func (*Daemon) DiskUsage ¶ added in v0.4.0
DiskUsage measures images (each once, however many names it has), containers' writable layers, and the state store.
func (*Daemon) NetworkRemove ¶ added in v0.10.0
NetworkRemove removes a created network no container uses.
func (*Daemon) PruneImages ¶ added in v0.4.0
func (d *Daemon) PruneImages(all bool) ([]DeleteItem, int64, error)
PruneImages removes images no container uses; without all only dangling (unnamed) ones, which this store never keeps, so nothing.
func (*Daemon) PruneVolumes ¶ added in v0.8.0
PruneVolumes removes unused anonymous volumes, or with all every unused one.
func (*Daemon) Pull ¶
func (d *Daemon) Pull(ctx context.Context, ref string, progress image.Progress) (string, *image.PullResult, error)
Pull fetches ref and names it; it returns the local name.
func (*Daemon) RemoveImage ¶
func (d *Daemon) RemoveImage(ref string, force bool) ([]DeleteItem, error)
RemoveImage untags ref (or every name of an image given by ID) and deletes the image's blobs once no name is left. An image a container uses is refused unless force.
func (*Daemon) RemoveVolume ¶ added in v0.8.0
RemoveVolume deletes a volume no container uses; with force a missing one is not an error (Docker's meaning of force for volumes).
func (*Daemon) ResolveImage ¶
ResolveImage finds an image by name ("hello", "hello:v1", "localhost:5000/x@sha256:…"), by ID ("sha256:…") or by unique ID prefix.
func (*Daemon) Restored ¶ added in v0.4.0
func (d *Daemon) Restored() container.RestoreReport
Restored says what was restored from the state store at start.
func (*Daemon) Storage ¶ added in v0.4.0
func (d *Daemon) Storage() StorageInfo
Storage describes the state store: what the embedder reports (Options.StorageInfo), plus the last failure to write to it.
type DeleteItem ¶
DeleteItem is one line of an image removal.
type DiskUsage ¶ added in v0.4.0
type DiskUsage struct {
LayersSize int64
Images []ImageInfo
Containers []container.Snapshot
Storage StorageInfo
}
DiskUsage is what `system df` reports.
type ImageInfo ¶
type ImageInfo struct {
ID image.Digest
RepoTags []string
RepoDigests []string
Created time.Time
Size int64
Labels map[string]string
Containers int
Image *image.Image
}
ImageInfo is one image as `docker images` lists it.
type Options ¶
type Options struct {
// Root holds the image store on disk. One of Root and Backend is
// required.
Root string
// Backend holds the image store elsewhere (memory, IndexedDB).
Backend image.Backend
// Limits bound pulls; zero means image.DefaultLimits.
Limits image.Limits
// Unpack bounds layer unpacking; zero means rootfs.DefaultLimits.
Unpack rootfs.Limits
// Registry configures registry pulls.
Registry image.RegistryOptions
// Containers configures the container manager (Executor required).
Containers container.Options
// MaxLowers bounds how many unpacked image trees stay in memory.
MaxLowers int
// StorageInfo, when set, reports the state store's usage for
// `system df` (a browser's quota estimate, a disk's free space).
StorageInfo func() StorageInfo
// ImagesRemoved, when set, is called after images were deleted (the
// browser executor drops its compiled-module cache then).
ImagesRemoved func()
// Volumes configures named volumes (they share Containers.Store).
Volumes volume.Options
// Networks configures networks (they share Containers.Store); every
// engine has "bridge", its default, and "none".
Networks network.Options
}
Options configures a daemon.