From 65a618886efc48562e5b9ff99ca630c83622419b Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Mon, 26 Oct 2020 11:35:02 +0100 Subject: new "image" mount type Add a new "image" mount type to `--mount`. The source of the mount is the name or ID of an image. The destination is the path inside the container. Image mounts further support an optional `rw,readwrite` parameter which if set to "true" will yield the mount writable inside the container. Note that no changes are propagated to the image mount on the host (which in any case is read only). Mounts are overlay mounts. To support read-only overlay mounts, vendor a non-release version of Buildah. Signed-off-by: Valentin Rothberg --- pkg/specgen/generate/container_create.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'pkg/specgen/generate') diff --git a/pkg/specgen/generate/container_create.go b/pkg/specgen/generate/container_create.go index f051537de..53dc35df1 100644 --- a/pkg/specgen/generate/container_create.go +++ b/pkg/specgen/generate/container_create.go @@ -223,6 +223,9 @@ func createContainerOptions(ctx context.Context, rt *libpod.Runtime, s *specgen. for _, overlayVolume := range s.OverlayVolumes { destinations = append(destinations, overlayVolume.Destination) } + for _, imageVolume := range s.ImageVolumes { + destinations = append(destinations, imageVolume.Destination) + } options = append(options, libpod.WithUserVolumes(destinations)) if len(volumes) != 0 { @@ -248,6 +251,18 @@ func createContainerOptions(ctx context.Context, rt *libpod.Runtime, s *specgen. options = append(options, libpod.WithOverlayVolumes(vols)) } + if len(s.ImageVolumes) != 0 { + var vols []*libpod.ContainerImageVolume + for _, v := range s.ImageVolumes { + vols = append(vols, &libpod.ContainerImageVolume{ + Dest: v.Destination, + Source: v.Source, + ReadWrite: v.ReadWrite, + }) + } + options = append(options, libpod.WithImageVolumes(vols)) + } + if s.Command != nil { options = append(options, libpod.WithCommand(s.Command)) } -- cgit v1.2.3-54-g00ecf