MCPcopy
hub / github.com/amir20/dozzle / removeProjectVolumes

Method removeProjectVolumes

internal/deploy/deployer.go:204–224  ·  view source on GitHub ↗
(ctx context.Context, projectName string)

Source from the content-addressed store, hash-verified

202}
203
204func (d *Deployer) removeProjectVolumes(ctx context.Context, projectName string) error {
205 vols, err := d.cli.VolumeList(ctx, client.VolumeListOptions{
206 Filters: make(client.Filters).Add("label", labelComposeProject+"="+projectName),
207 })
208 if err != nil {
209 return fmt.Errorf("listing volumes: %w", err)
210 }
211 g, gctx := errgroup.WithContext(ctx)
212 g.SetLimit(5)
213 for _, v := range vols.Items {
214 g.Go(func() error {
215 if _, err := d.cli.VolumeRemove(gctx, v.Name, client.VolumeRemoveOptions{Force: false}); err != nil {
216 log.Warn().Err(err).Str("volume", v.Name).Msg("Failed to remove volume")
217 return err
218 }
219 log.Info().Str("volume", v.Name).Msg("Removed volume")
220 return nil
221 })
222 }
223 return g.Wait()
224}
225
226func (d *Deployer) removeProjectContainers(ctx context.Context, projectName string, status chan<- StatusUpdate) error {
227 containers, err := d.cli.ContainerList(ctx, client.ContainerListOptions{

Callers 1

RemoveMethod · 0.95

Calls 4

InfoMethod · 0.80
WaitMethod · 0.80
VolumeListMethod · 0.65
VolumeRemoveMethod · 0.65

Tested by

no test coverage detected