Documentation
¶
Overview ¶
Copyright 2020 Docker Compose CLI authors
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- func ImageDigestResolver(ctx context.Context, file *configfile.ConfigFile, apiClient client.APIClient) func(named reference.Named) (digest.Digest, error)
- func InDependencyOrder(ctx context.Context, project *types.Project, ...) error
- func InReverseDependencyOrder(ctx context.Context, project *types.Project, ...) error
- func NetworkHash(o *types.NetworkConfig) (string, error)
- func NewComposeService(dockerCli command.Cli) api.Service
- func ServiceHash(o types.ServiceConfig) (string, error)
- func ToMobyEnv(environment compose.MappingWithEquals) []string
- func ToSeconds(d *compose.Duration) *int
- func VolumeHash(o types.VolumeConfig) (string, error)
- func WithRootNodesAndDown(nodes []string) func(*graphTraversal)
- type ContainerStdin
- type ContainerStdout
- type Containers
- type Graph
- func (g *Graph) AddEdge(source string, destination string) error
- func (g *Graph) AddVertex(key string, service string, initialStatus ServiceStatus)
- func (g *Graph) FilterChildren(key string, status ServiceStatus) []*Vertex
- func (g *Graph) FilterParents(key string, status ServiceStatus) []*Vertex
- func (g *Graph) HasCycles() (bool, error)
- func (g *Graph) Leaves() []*Vertex
- func (g *Graph) Roots() []*Vertex
- func (g *Graph) UpdateStatus(key string, status ServiceStatus)
- type ImagePruneMode
- type ImagePruneOptions
- type ImagePruner
- type JsonMessage
- type ServiceStatus
- type Vertex
Constants ¶
const ( // ContainerCreated created status ContainerCreated = "created" // ContainerRestarting restarting status ContainerRestarting = "restarting" // ContainerRunning running status ContainerRunning = "running" // ContainerRemoving removing status ContainerRemoving = "removing" // ContainerPaused paused status ContainerPaused = "paused" // ContainerExited exited status ContainerExited = "exited" // ContainerDead dead status ContainerDead = "dead" )
const ( ErrorType = "error" InfoType = "info" SetEnvType = "setenv" )
const ( PreparingPhase = "Preparing" WaitingPhase = "Waiting" PullingFsPhase = "Pulling fs layer" DownloadingPhase = "Downloading" DownloadCompletePhase = "Download complete" ExtractingPhase = "Extracting" VerifyingChecksumPhase = "Verifying Checksum" AlreadyExistsPhase = "Already exists" PullCompletePhase = "Pull complete" )
const ServiceConditionRunningOrHealthy = "running_or_healthy"
ServiceConditionRunningOrHealthy is a service condition on status running or healthy
Variables ¶
This section is empty.
Functions ¶
func ImageDigestResolver ¶ added in v2.24.7
func ImageDigestResolver(ctx context.Context, file *configfile.ConfigFile, apiClient client.APIClient) func(named reference.Named) (digest.Digest, error)
ImageDigestResolver creates a func able to resolve image digest from a docker ref,
func InDependencyOrder ¶
func InDependencyOrder(ctx context.Context, project *types.Project, fn func(context.Context, string) error, options ...func(*graphTraversal)) error
InDependencyOrder applies the function to the services of the project taking in account the dependency order
func InReverseDependencyOrder ¶
func InReverseDependencyOrder(ctx context.Context, project *types.Project, fn func(context.Context, string) error, options ...func(*graphTraversal)) error
InReverseDependencyOrder applies the function to the services of the project in reverse order of dependencies
func NetworkHash ¶ added in v2.31.0
func NetworkHash(o *types.NetworkConfig) (string, error)
NetworkHash computes the configuration hash for a network.
func NewComposeService ¶
NewComposeService create a local implementation of the compose.Service API
func ServiceHash ¶
func ServiceHash(o types.ServiceConfig) (string, error)
ServiceHash computes the configuration hash for a service.
func ToMobyEnv ¶
func ToMobyEnv(environment compose.MappingWithEquals) []string
ToMobyEnv convert into []string
func VolumeHash ¶ added in v2.32.0
func VolumeHash(o types.VolumeConfig) (string, error)
VolumeHash computes the configuration hash for a volume.
func WithRootNodesAndDown ¶ added in v2.19.0
func WithRootNodesAndDown(nodes []string) func(*graphTraversal)
Types ¶
type ContainerStdin ¶
type ContainerStdin struct {
moby.HijackedResponse
}
ContainerStdin implement WriteCloser for moby.HijackedResponse
type ContainerStdout ¶
type ContainerStdout struct {
moby.HijackedResponse
}
ContainerStdout implement ReadCloser for moby.HijackedResponse
type Graph ¶
Graph represents project as service dependencies
func NewGraph ¶
func NewGraph(project *types.Project, initialStatus ServiceStatus) (*Graph, error)
NewGraph returns the dependency graph of the services
func (*Graph) AddEdge ¶
AddEdge adds a relationship of dependency between vertices `source` and `destination`
func (*Graph) AddVertex ¶
func (g *Graph) AddVertex(key string, service string, initialStatus ServiceStatus)
AddVertex adds a vertex to the Graph
func (*Graph) FilterChildren ¶
func (g *Graph) FilterChildren(key string, status ServiceStatus) []*Vertex
FilterChildren returns children of a certain vertex that are in a certain status
func (*Graph) FilterParents ¶
func (g *Graph) FilterParents(key string, status ServiceStatus) []*Vertex
FilterParents returns the parents of a certain vertex that are in a certain status
func (*Graph) UpdateStatus ¶
func (g *Graph) UpdateStatus(key string, status ServiceStatus)
UpdateStatus updates the status of a certain vertex
type ImagePruneMode ¶ added in v2.11.0
type ImagePruneMode string
ImagePruneMode controls how aggressively images associated with the project are removed from the engine.
const ( // ImagePruneNone indicates that no project images should be removed. ImagePruneNone ImagePruneMode = "" // ImagePruneLocal indicates that only images built locally by Compose // should be removed. ImagePruneLocal ImagePruneMode = "local" // ImagePruneAll indicates that all project-associated images, including // remote images should be removed. ImagePruneAll ImagePruneMode = "all" )
type ImagePruneOptions ¶ added in v2.11.0
type ImagePruneOptions struct { Mode ImagePruneMode // RemoveOrphans will result in the removal of images that were built for // the project regardless of whether they are for a known service if true. RemoveOrphans bool }
ImagePruneOptions controls the behavior of image pruning.
type ImagePruner ¶ added in v2.11.0
type ImagePruner struct {
// contains filtered or unexported fields
}
ImagePruner handles image removal during Compose `down` operations.
func NewImagePruner ¶ added in v2.11.0
func NewImagePruner(imageClient client.ImageAPIClient, project *types.Project) *ImagePruner
NewImagePruner creates an ImagePruner object for a project.
func (*ImagePruner) ImagesToPrune ¶ added in v2.11.0
func (p *ImagePruner) ImagesToPrune(ctx context.Context, opts ImagePruneOptions) ([]string, error)
ImagesToPrune returns the set of images that should be removed.
type JsonMessage ¶ added in v2.35.0
type ServiceStatus ¶
type ServiceStatus int
ServiceStatus indicates the status of a service
const ( ServiceStopped ServiceStatus = iota ServiceStarted )
Services status flags
type Vertex ¶
type Vertex struct { Key string Service string Status ServiceStatus Children map[string]*Vertex Parents map[string]*Vertex }
Vertex represents a service in the dependencies structure
func NewVertex ¶
func NewVertex(key string, service string, initialStatus ServiceStatus) *Vertex
NewVertex is the constructor function for the Vertex
func (*Vertex) GetChildren ¶
GetChildren returns a slice with the child vertices of the Vertex
func (*Vertex) GetParents ¶
GetParents returns a slice with the parent vertices of the Vertex
Source Files
¶
- attach.go
- attach_service.go
- build.go
- build_bake.go
- build_buildkit.go
- build_classic.go
- commit.go
- compose.go
- container.go
- containers.go
- convergence.go
- convert.go
- cp.go
- create.go
- dependencies.go
- desktop.go
- down.go
- envresolver.go
- events.go
- exec.go
- export.go
- filters.go
- generate.go
- hash.go
- hook.go
- image_pruner.go
- images.go
- kill.go
- logs.go
- ls.go
- pause.go
- plugins.go
- port.go
- printer.go
- ps.go
- publish.go
- pull.go
- push.go
- remove.go
- restart.go
- run.go
- scale.go
- secrets.go
- start.go
- stop.go
- top.go
- up.go
- viz.go
- wait.go
- watch.go