MCPcopy
hub / github.com/docker/compose / createVolume

Method createVolume

pkg/compose/create.go:1688–1708  ·  pkg/compose/create.go::composeService.createVolume
(ctx context.Context, volume types.VolumeConfig)

Source from the content-addressed store, hash-verified

1686}
1687
1688func (s *composeService) createVolume(ctx context.Context, volume types.VolumeConfig) error {
1689 eventName := fmt.Sprintf("Volume %s", volume.Name)
1690 s.events.On(creatingEvent(eventName))
1691 hash, err := VolumeHash(volume)
1692 if err != nil {
1693 return err
1694 }
1695 volume.CustomLabels.Add(api.ConfigHashLabel, hash)
1696 _, err = s.apiClient().VolumeCreate(ctx, client.VolumeCreateOptions{
1697 Labels: mergeLabels(volume.Labels, volume.CustomLabels),
1698 Name: volume.Name,
1699 Driver: volume.Driver,
1700 DriverOpts: volume.DriverOpts,
1701 })
1702 if err != nil {
1703 s.events.On(errorEvent(eventName, err.Error()))
1704 return err
1705 }
1706 s.events.On(createdEvent(eventName))
1707 return nil
1708}
1709
1710func parseIPAMPool(pool *types.IPAMPool) (network.IPAMConfig, error) {
1711 var (

Callers 2

ensureVolumeMethod · 0.95
execCreateVolumeMethod · 0.80

Calls 10

apiClientMethod · 0.95
creatingEventFunction · 0.85
VolumeHashFunction · 0.85
mergeLabelsFunction · 0.85
errorEventFunction · 0.85
createdEventFunction · 0.85
ErrorMethod · 0.80
OnMethod · 0.65
AddMethod · 0.45
VolumeCreateMethod · 0.45

Tested by

no test coverage detected