MCPcopy Create free account
hub / github.com/OpenSN-Library/OpenSN-Library / RemoveContainer

Function RemoveContainer

daemon/pkg/module/instance_module.go:182–203  ·  view source on GitHub ↗
(instance *model.Instance)

Source from the content-addressed store, hash-verified

180}
181
182func RemoveContainer(instance *model.Instance) error {
183 containerID := fmt.Sprintf("%s_%s", instance.Type, instance.InstanceID)
184 err := utils.DoWithRetry(func() error {
185 _, err := utils.DockerClient.ContainerRemove(
186 context.Background(),
187 containerID,
188 client.ContainerRemoveOptions{Force: true},
189 )
190 return err
191 }, 4)
192
193 if err != nil {
194 err := fmt.Errorf(
195 "stop container %s error: %s",
196 containerID,
197 err.Error(),
198 )
199 return err
200 }
201
202 return nil
203}
204
205func UpdateInstanceState(oldInstance, newInstance *model.Instance) error {
206 var err error

Callers 1

UpdateInstanceStateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected