From 4cc2dce80732af4ee13760661225134e7ccd8a00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Gronowski?= Date: Mon, 17 Feb 2025 12:35:28 +0100 Subject: [PATCH] cli/compose: Fix Image Subpath MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit handleImageToMount was an exact copy of handleBindToMount instead of populating the ImageOptions. Signed-off-by: Paweł Gronowski --- cli/compose/convert/volume.go | 6 +++--- cli/compose/types/types.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cli/compose/convert/volume.go b/cli/compose/convert/volume.go index a60f4bd32e..e7dc989b2a 100644 --- a/cli/compose/convert/volume.go +++ b/cli/compose/convert/volume.go @@ -107,9 +107,9 @@ func handleImageToMount(volume composetypes.ServiceVolumeConfig) (mount.Mount, e if volume.Cluster != nil { return mount.Mount{}, errors.New("cluster options are incompatible with type image") } - if volume.Bind != nil { - result.BindOptions = &mount.BindOptions{ - Propagation: mount.Propagation(volume.Bind.Propagation), + if volume.Image != nil { + result.ImageOptions = &mount.ImageOptions{ + Subpath: volume.Image.Subpath, } } return result, nil diff --git a/cli/compose/types/types.go b/cli/compose/types/types.go index ef778422bc..207ce89e06 100644 --- a/cli/compose/types/types.go +++ b/cli/compose/types/types.go @@ -415,7 +415,7 @@ type ServiceVolumeVolume struct { // ServiceVolumeImage are options for a service volume of type image type ServiceVolumeImage struct { - Subpath bool `mapstructure:"subpath" yaml:"subpath,omitempty" json:"subpath,omitempty"` + Subpath string `mapstructure:"subpath" yaml:"subpath,omitempty" json:"subpath,omitempty"` } // ServiceVolumeTmpfs are options for a service volume of type tmpfs