dockercompat

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2022 License: Apache-2.0 Imports: 17 Imported by: 11

Documentation

Overview

Package dockercompat mimics `docker inspect` objects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientVersion added in v0.11.1

type ClientVersion struct {
	Version   string
	GitCommit string
	GoVersion string
	Os        string // GOOS
	Arch      string // GOARCH
}

ClientVersion is from https://github.com/docker/cli/blob/v20.10.8/cli/command/system/version.go#L74-L87

type ComponentVersion added in v0.11.1

type ComponentVersion struct {
	Name    string
	Version string
	Details map[string]string `json:",omitempty"`
}

ComponentVersion describes the version information for a specific component. From https://github.com/moby/moby/blob/v20.10.8/api/types/types.go#L112-L117

type Config added in v0.9.0

type Config struct {
	// TODO: Hostname     string      // Hostname
	// TODO: Domainname   string      // Domainname
	User string // User that will run the command(s) inside the container, also support user:group
	// TODO: AttachStdin  bool        // Attach the standard input, makes possible user interaction
	// TODO: AttachStdout bool        // Attach the standard output
	// TODO: AttachStderr bool        // Attach the standard error
	ExposedPorts nat.PortSet `json:",omitempty"` // List of exposed ports
	// TODO: Tty          bool        // Attach standard streams to a tty, including stdin if it is not closed.
	// TODO: OpenStdin    bool        // Open stdin
	// TODO: StdinOnce    bool        // If true, close stdin after the 1 attached client disconnects.
	Env []string // List of environment variable to set in the container
	Cmd []string // Command to run when starting the container
	// TODO Healthcheck     *HealthConfig       `json:",omitempty"` // Healthcheck describes how to check the container is healthy
	// TODO: ArgsEscaped     bool                `json:",omitempty"` // True if command is already escaped (meaning treat as a command line) (Windows specific).
	// TODO: Image           string              // Name of the image as it was passed by the operator (e.g. could be symbolic)
	Volumes    map[string]struct{} // List of volumes (mounts) used for the container
	WorkingDir string              // Current directory (PWD) in the command will be launched
	Entrypoint []string            // Entrypoint to run when starting the container
	// TODO: NetworkDisabled bool                `json:",omitempty"` // Is network disabled
	// TODO: MacAddress      string              `json:",omitempty"` // Mac Address of the container
	// TODO: OnBuild         []string            // ONBUILD metadata that were defined on the image Dockerfile
	Labels map[string]string // List of labels set to this container

}

config is from https://github.com/moby/moby/blob/8dbd90ec00daa26dc45d7da2431c965dec99e8b4/api/types/container/config.go#L37-L69

type Container

type Container struct {
	ID             string `json:"Id"`
	Created        string
	Path           string
	Args           []string
	State          *ContainerState
	Image          string
	ResolvConfPath string
	HostnamePath   string
	// TODO: HostsPath      string
	LogPath string
	// Unimplemented: Node            *ContainerNode `json:",omitempty"` // Node is only propagated by Docker Swarm standalone API
	Name string
	// TODO: RestartCount int
	Driver   string
	Platform string
	// TODO: MountLabel      string
	// TODO: ProcessLabel    string
	AppArmorProfile string

	// TODO: Mounts          []MountPoint
	// TODO: Config          *container.Config
	NetworkSettings *NetworkSettings
}

Container mimics a `docker container inspect` object. From https://github.com/moby/moby/blob/v20.10.1/api/types/types.go#L340-L374

func ContainerFromNative

func ContainerFromNative(n *native.Container) (*Container, error)

ContainerFromNative instantiates a Docker-compatible Container from containerd-native Container.

type ContainerState

type ContainerState struct {
	Status  string // String representation of the container state. Can be one of "created", "running", "paused", "restarting", "removing", "exited", or "dead"
	Running bool
	Paused  bool
	// TODO:	Restarting bool
	// TODO: OOMKilled  bool
	// TODO:	Dead       bool
	Pid      int
	ExitCode int
	// TODO: Error      string
	// TODO: StartedAt  string
	FinishedAt string
}

ContainerState is from https://github.com/moby/moby/blob/v20.10.1/api/types/types.go#L313-L326

type DefaultNetworkSettings

type DefaultNetworkSettings struct {
	// TODO EndpointID          string // EndpointID uniquely represents a service endpoint in a Sandbox
	// TODO Gateway             string // Gateway holds the gateway address for the network
	GlobalIPv6Address   string // GlobalIPv6Address holds network's global IPv6 address
	GlobalIPv6PrefixLen int    // GlobalIPv6PrefixLen represents mask length of network's global IPv6 address
	IPAddress           string // IPAddress holds the IPv4 address for the network
	IPPrefixLen         int    // IPPrefixLen represents mask length of network's IPv4 address
	// TODO IPv6Gateway         string // IPv6Gateway holds gateway address specific for IPv6
	MacAddress string // MacAddress holds the MAC address for the network
}

DefaultNetworkSettings is from https://github.com/moby/moby/blob/v20.10.1/api/types/types.go#L405-L414

type IPAM added in v0.11.0

type IPAM struct {
	// Driver is omitted
	Config []IPAMConfig `json:"Config,omitempty"`
}

type IPAMConfig added in v0.11.0

type IPAMConfig struct {
	Subnet  string `json:"Subnet,omitempty"`
	Gateway string `json:"Gateway,omitempty"`
	IPRange string `json:"IPRange,omitempty"`
}

type Image added in v0.9.0

type Image struct {
	ID          string `json:"Id"`
	RepoTags    []string
	RepoDigests []string
	// TODO: Parent      string
	Comment string
	Created string
	// TODO: Container   string
	// TODO: ContainerConfig *container.Config
	// TODO: DockerVersion string
	Author       string
	Config       *Config
	Architecture string
	// TODO: Variant       string `json:",omitempty"`
	Os string
	// TODO: OsVersion     string `json:",omitempty"`
	// TODO: Size          int64
	// TODO: VirtualSize   int64
	// TODO: GraphDriver     GraphDriverData
	RootFS   RootFS
	Metadata ImageMetadata
}

Image mimics a `docker image inspect` object. From https://github.com/moby/moby/blob/v20.10.1/api/types/types.go#L340-L374

func ImageFromNative added in v0.9.0

func ImageFromNative(n *native.Image) (*Image, error)

type ImageMetadata added in v0.9.0

type ImageMetadata struct {
	LastTagTime time.Time `json:",omitempty"`
}

type Info added in v0.7.3

type Info struct {
	ID          string
	Driver      string
	Plugins     PluginsInfo
	MemoryLimit bool
	SwapLimit   bool
	// KernelMemory is omitted because it is deprecated in the Moby
	CPUCfsPeriod      bool `json:"CpuCfsPeriod"`
	CPUCfsQuota       bool `json:"CpuCfsQuota"`
	CPUShares         bool
	CPUSet            bool
	PidsLimit         bool
	IPv4Forwarding    bool
	BridgeNfIptables  bool
	BridgeNfIP6tables bool `json:"BridgeNfIp6tables"`
	// Nfd is omitted because it does not make sense for nerdctl
	OomKillDisable bool
	// NGoroutines is omitted because it does not make sense for nerdctl
	SystemTime    string
	LoggingDriver string
	CgroupDriver  string
	CgroupVersion string `json:",omitempty"`
	// NEventsListener is omitted because it does not make sense for nerdctl
	KernelVersion   string
	OperatingSystem string
	OSType          string
	Architecture    string // e.g., "x86_64", not "amd64" (Corresponds to Docker)
	NCPU            int
	MemTotal        int64
	Name            string
	ServerVersion   string
	SecurityOptions []string

	Warnings []string
}

Info mimics a `docker info` object. From https://github.com/moby/moby/blob/v20.10.8/api/types/types.go#L146-L216

type Network added in v0.11.0

type Network struct {
	Name   string            `json:"Name"`
	ID     string            `json:"Id,omitempty"` // optional in nerdctl
	IPAM   IPAM              `json:"IPAM,omitempty"`
	Labels map[string]string `json:"Labels"`
}

Network mimics a `docker network inspect` object. From https://github.com/moby/moby/blob/v20.10.7/api/types/types.go#L430-L448

func NetworkFromNative added in v0.11.0

func NetworkFromNative(n *native.Network) (*Network, error)

type NetworkEndpointSettings

type NetworkEndpointSettings struct {
	// Configurations
	// TODO IPAMConfig *EndpointIPAMConfig
	// TODO Links      []string
	// TODO Aliases    []string
	// Operational data
	// TODO NetworkID           string
	// TODO EndpointID          string
	// TODO Gateway             string
	IPAddress   string
	IPPrefixLen int
	// TODO IPv6Gateway         string
	GlobalIPv6Address   string
	GlobalIPv6PrefixLen int
	MacAddress          string
}

NetworkEndpointSettings is from https://github.com/moby/moby/blob/v20.10.1/api/types/network/network.go#L49-L65

type NetworkSettings

type NetworkSettings struct {
	Ports *nat.PortMap `json:",omitempty"`
	DefaultNetworkSettings
	Networks map[string]*NetworkEndpointSettings
}

type PluginsInfo added in v0.7.3

type PluginsInfo struct {
	Log     []string
	Storage []string // nerdctl extension
}

type RootFS added in v0.9.0

type RootFS struct {
	Type      string
	Layers    []string `json:",omitempty"`
	BaseLayer string   `json:",omitempty"`
}

type ServerVersion added in v0.11.1

type ServerVersion struct {
	Components []ComponentVersion
}

ServerVersion is from https://github.com/moby/moby/blob/v20.10.8/api/types/types.go#L119-L137

type VersionInfo added in v0.11.1

type VersionInfo struct {
	Client ClientVersion
	Server *ServerVersion
}

VersionInfo mimics a `docker version` object. From https://github.com/docker/cli/blob/v20.10.8/cli/command/system/version.go#L68-L72

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL