2018-09-11 08:46:30 -04:00
|
|
|
package types
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"io"
|
|
|
|
|
|
|
|
"github.com/docker/docker/api/types"
|
|
|
|
ver "github.com/hashicorp/go-version"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
// CommunityEngineImage is the repo name for the community engine
|
|
|
|
CommunityEngineImage = "engine-community"
|
|
|
|
|
|
|
|
// EnterpriseEngineImage is the repo name for the enterprise engine
|
|
|
|
EnterpriseEngineImage = "engine-enterprise"
|
2018-09-20 14:02:11 -04:00
|
|
|
|
|
|
|
// RegistryPrefix is the default prefix used to pull engine images
|
|
|
|
RegistryPrefix = "docker.io/store/docker"
|
|
|
|
|
|
|
|
// ReleaseNotePrefix is where to point users to for release notes
|
|
|
|
ReleaseNotePrefix = "https://docs.docker.com/releasenotes"
|
2018-09-28 17:06:28 -04:00
|
|
|
|
|
|
|
// RuntimeMetadataName is the name of the runtime metadata file
|
|
|
|
// When stored as a label on the container it is prefixed by "com.docker."
|
|
|
|
RuntimeMetadataName = "distribution_based_engine"
|
2018-09-11 08:46:30 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
// ContainerizedClient can be used to manage the lifecycle of
|
|
|
|
// dockerd running as a container on containerd.
|
|
|
|
type ContainerizedClient interface {
|
|
|
|
Close() error
|
|
|
|
ActivateEngine(ctx context.Context,
|
|
|
|
opts EngineInitOptions,
|
|
|
|
out OutStream,
|
|
|
|
authConfig *types.AuthConfig,
|
|
|
|
healthfn func(context.Context) error) error
|
|
|
|
DoUpdate(ctx context.Context,
|
|
|
|
opts EngineInitOptions,
|
|
|
|
out OutStream,
|
|
|
|
authConfig *types.AuthConfig,
|
|
|
|
healthfn func(context.Context) error) error
|
|
|
|
}
|
|
|
|
|
|
|
|
// EngineInitOptions contains the configuration settings
|
|
|
|
// use during initialization of a containerized docker engine
|
|
|
|
type EngineInitOptions struct {
|
2018-09-28 17:06:28 -04:00
|
|
|
RegistryPrefix string
|
|
|
|
EngineImage string
|
|
|
|
EngineVersion string
|
|
|
|
ConfigFile string
|
|
|
|
RuntimeMetadataDir string
|
2018-09-11 08:46:30 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// AvailableVersions groups the available versions which were discovered
|
|
|
|
type AvailableVersions struct {
|
|
|
|
Downgrades []DockerVersion
|
|
|
|
Patches []DockerVersion
|
|
|
|
Upgrades []DockerVersion
|
|
|
|
}
|
|
|
|
|
|
|
|
// DockerVersion wraps a semantic version to retain the original tag
|
|
|
|
// since the docker date based versions don't strictly follow semantic
|
|
|
|
// versioning (leading zeros, etc.)
|
|
|
|
type DockerVersion struct {
|
|
|
|
ver.Version
|
|
|
|
Tag string
|
|
|
|
}
|
|
|
|
|
|
|
|
// Update stores available updates for rendering in a table
|
|
|
|
type Update struct {
|
|
|
|
Type string
|
|
|
|
Version string
|
|
|
|
Notes string
|
|
|
|
}
|
|
|
|
|
|
|
|
// OutStream is an output stream used to write normal program output.
|
|
|
|
type OutStream interface {
|
|
|
|
io.Writer
|
|
|
|
FD() uintptr
|
|
|
|
IsTerminal() bool
|
|
|
|
}
|
2018-09-28 17:06:28 -04:00
|
|
|
|
|
|
|
// RuntimeMetadata holds platform information about the daemon
|
|
|
|
type RuntimeMetadata struct {
|
|
|
|
Platform string `json:"platform"`
|
|
|
|
ContainerdMinVersion string `json:"containerd_min_version"`
|
|
|
|
Runtime string `json:"runtime"`
|
|
|
|
EngineImage string `json:"engine_image"`
|
|
|
|
}
|