MCPcopy Create free account
hub / github.com/docker/cli / handleImageToMount

Function handleImageToMount

cli/compose/convert/volume.go:94–118  ·  view source on GitHub ↗
(volume composetypes.ServiceVolumeConfig)

Source from the content-addressed store, hash-verified

92}
93
94func handleImageToMount(volume composetypes.ServiceVolumeConfig) (mount.Mount, error) {
95 result := createMountFromVolume(volume)
96
97 if volume.Source == "" {
98 return mount.Mount{}, errors.New("invalid image source, source cannot be empty")
99 }
100 if volume.Volume != nil {
101 return mount.Mount{}, errors.New("volume options are incompatible with type image")
102 }
103 if volume.Bind != nil {
104 return mount.Mount{}, errors.New("bind options are incompatible with type image")
105 }
106 if volume.Tmpfs != nil {
107 return mount.Mount{}, errors.New("tmpfs options are incompatible with type image")
108 }
109 if volume.Cluster != nil {
110 return mount.Mount{}, errors.New("cluster options are incompatible with type image")
111 }
112 if volume.Image != nil {
113 result.ImageOptions = &mount.ImageOptions{
114 Subpath: volume.Image.Subpath,
115 }
116 }
117 return result, nil
118}
119
120func handleBindToMount(volume composetypes.ServiceVolumeConfig) (mount.Mount, error) {
121 result := createMountFromVolume(volume)

Callers 1

convertVolumeToMountFunction · 0.85

Calls 1

createMountFromVolumeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…