MCPcopy Create free account
hub / github.com/docker/compose / Compose

Interface Compose

pkg/api/api.go:83–152  ·  view source on GitHub ↗

Compose is the API interface one can use to programmatically use docker/compose in a third-party software Use [compose.NewComposeService] to get an actual instance

Source from the content-addressed store, hash-verified

81// Compose is the API interface one can use to programmatically use docker/compose in a third-party software
82// Use [compose.NewComposeService] to get an actual instance
83type Compose interface {
84 // Build executes the equivalent to a `compose build`
85 Build(ctx context.Context, project *types.Project, options BuildOptions) error
86 // Push executes the equivalent to a `compose push`
87 Push(ctx context.Context, project *types.Project, options PushOptions) error
88 // Pull executes the equivalent of a `compose pull`
89 Pull(ctx context.Context, project *types.Project, options PullOptions) error
90 // Create executes the equivalent to a `compose create`
91 Create(ctx context.Context, project *types.Project, options CreateOptions) error
92 // Start executes the equivalent to a `compose start`
93 Start(ctx context.Context, projectName string, options StartOptions) error
94 // Restart restarts containers
95 Restart(ctx context.Context, projectName string, options RestartOptions) error
96 // Stop executes the equivalent to a `compose stop`
97 Stop(ctx context.Context, projectName string, options StopOptions) error
98 // Up executes the equivalent to a `compose up`
99 Up(ctx context.Context, project *types.Project, options UpOptions) error
100 // Down executes the equivalent to a `compose down`
101 Down(ctx context.Context, projectName string, options DownOptions) error
102 // Logs executes the equivalent to a `compose logs`
103 Logs(ctx context.Context, projectName string, consumer LogConsumer, options LogOptions) error
104 // Ps executes the equivalent to a `compose ps`
105 Ps(ctx context.Context, projectName string, options PsOptions) ([]ContainerSummary, error)
106 // List executes the equivalent to a `docker stack ls`
107 List(ctx context.Context, options ListOptions) ([]Stack, error)
108 // Kill executes the equivalent to a `compose kill`
109 Kill(ctx context.Context, projectName string, options KillOptions) error
110 // RunOneOffContainer creates a service oneoff container and starts its dependencies
111 RunOneOffContainer(ctx context.Context, project *types.Project, opts RunOptions) (int, error)
112 // Remove executes the equivalent to a `compose rm`
113 Remove(ctx context.Context, projectName string, options RemoveOptions) error
114 // Exec executes a command in a running service container
115 Exec(ctx context.Context, projectName string, options RunOptions) (int, error)
116 // Attach STDIN,STDOUT,STDERR to a running service container
117 Attach(ctx context.Context, projectName string, options AttachOptions) error
118 // Copy copies a file/folder between a service container and the local filesystem
119 Copy(ctx context.Context, projectName string, options CopyOptions) error
120 // Pause executes the equivalent to a `compose pause`
121 Pause(ctx context.Context, projectName string, options PauseOptions) error
122 // UnPause executes the equivalent to a `compose unpause`
123 UnPause(ctx context.Context, projectName string, options PauseOptions) error
124 // Top executes the equivalent to a `compose top`
125 Top(ctx context.Context, projectName string, services []string) ([]ContainerProcSummary, error)
126 // Events executes the equivalent to a `compose events`
127 Events(ctx context.Context, projectName string, options EventsOptions) error
128 // Port executes the equivalent to a `compose port`
129 Port(ctx context.Context, projectName string, service string, port uint16, options PortOptions) (string, int, error)
130 // Publish executes the equivalent to a `compose publish`
131 Publish(ctx context.Context, project *types.Project, repository string, options PublishOptions) error
132 // Images executes the equivalent of a `compose images`
133 Images(ctx context.Context, projectName string, options ImagesOptions) (map[string]ImageSummary, error)
134 // Watch services' development context and sync/notify/rebuild/restart on changes
135 Watch(ctx context.Context, project *types.Project, options WatchOptions) error
136 // Viz generates a graphviz graph of the project services
137 Viz(ctx context.Context, project *types.Project, options VizOptions) (string, error)
138 // Wait blocks until at least one of the services' container exits
139 Wait(ctx context.Context, projectName string, options WaitOptions) (int64, error)
140 // Scale manages numbers of container instances running per service

Callers 111

runBuildFunction · 0.65
PushFunction · 0.65
runPushFunction · 0.65
runPullFunction · 0.65
writeEnvFileFunction · 0.65
mustTouchFunction · 0.65
runUpFunction · 0.65
runCreateFunction · 0.65
StartWithNewGroupIDFunction · 0.65
LogsMethod · 0.65
PullModelMethod · 0.65

Implementers 3

MockComposepkg/mocks/mock_docker_compose_api.go
MockComposeMockRecorderpkg/mocks/mock_docker_compose_api.go
composeServicepkg/compose/compose.go

Calls

no outgoing calls

Tested by

no test coverage detected