MCPcopy
hub / github.com/basecamp/once / ContainerName

Method ContainerName

internal/docker/application.go:65–82  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

63}
64
65func (a *Application) ContainerName(ctx context.Context) (string, error) {
66 containers, err := a.namespace.client.ContainerList(ctx, container.ListOptions{All: true})
67 if err != nil {
68 return "", err
69 }
70
71 for _, c := range containers {
72 if len(c.Names) == 0 {
73 continue
74 }
75 name := strings.TrimPrefix(c.Names[0], "/")
76 if a.namespace.containerAppName(name) == a.Settings.Name {
77 return name, nil
78 }
79 }
80
81 return "", fmt.Errorf("no container found for app %s", a.Settings.Name)
82}
83
84func (a *Application) Volume(ctx context.Context) (*ApplicationVolume, error) {
85 vol, err := FindVolume(ctx, a.namespace, a.Settings.Name)

Callers 15

backupToWriterMethod · 0.95
StopMethod · 0.95
StartMethod · 0.95
runningImageIDMethod · 0.95
TestGaplessDeploymentFunction · 0.80
TestStartStopFunction · 0.80
TestContainerLogConfigFunction · 0.80
TestBackupFunction · 0.80
TestRestoreFunction · 0.80
TestBackupHookBehaviorFunction · 0.80

Calls 2

containerAppNameMethod · 0.80
ContainerListMethod · 0.65

Tested by 12

TestGaplessDeploymentFunction · 0.64
TestStartStopFunction · 0.64
TestContainerLogConfigFunction · 0.64
TestBackupFunction · 0.64
TestRestoreFunction · 0.64
TestBackupHookBehaviorFunction · 0.64
TestDeployWithSettingsFunction · 0.64
TestContainerResourcesFunction · 0.64