summaryrefslogtreecommitdiff
path: root/pkg/specgen
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/specgen')
-rw-r--r--pkg/specgen/generate/container_create.go4
-rw-r--r--pkg/specgen/specgen.go9
2 files changed, 11 insertions, 2 deletions
diff --git a/pkg/specgen/generate/container_create.go b/pkg/specgen/generate/container_create.go
index 1c0c92f4f..91230338e 100644
--- a/pkg/specgen/generate/container_create.go
+++ b/pkg/specgen/generate/container_create.go
@@ -102,7 +102,7 @@ func MakeContainer(ctx context.Context, rt *libpod.Runtime, s *specgen.SpecGener
var newImage *libimage.Image
var imageData *libimage.ImageData
if s.Rootfs != "" {
- options = append(options, libpod.WithRootFS(s.Rootfs))
+ options = append(options, libpod.WithRootFS(s.Rootfs, s.RootfsOverlay))
} else {
var resolvedImageName string
newImage, resolvedImageName, err = rt.LibimageRuntime().LookupImage(s.Image, nil)
@@ -406,7 +406,7 @@ func createContainerOptions(ctx context.Context, rt *libpod.Runtime, s *specgen.
options = append(options, libpod.WithShmSize(*s.ShmSize))
}
if s.Rootfs != "" {
- options = append(options, libpod.WithRootFS(s.Rootfs))
+ options = append(options, libpod.WithRootFS(s.Rootfs, s.RootfsOverlay))
}
// Default used if not overridden on command line
diff --git a/pkg/specgen/specgen.go b/pkg/specgen/specgen.go
index 0c30c498a..e0609c5bc 100644
--- a/pkg/specgen/specgen.go
+++ b/pkg/specgen/specgen.go
@@ -2,6 +2,7 @@ package specgen
import (
"net"
+ "strings"
"syscall"
"github.com/containers/image/v5/manifest"
@@ -209,6 +210,8 @@ type ContainerStorageConfig struct {
// Conflicts with Image.
// At least one of Image or Rootfs must be specified.
Rootfs string `json:"rootfs,omitempty"`
+ // RootfsOverlay tells if rootfs is actuall an overlay on top of base path
+ RootfsOverlay bool `json:"rootfs_overlay,omitempty"`
// ImageVolumeMode indicates how image volumes will be created.
// Supported modes are "ignore" (do not create), "tmpfs" (create as
// tmpfs), and "anonymous" (create as anonymous volumes).
@@ -528,6 +531,12 @@ func NewSpecGenerator(arg string, rootfs bool) *SpecGenerator {
csc := ContainerStorageConfig{}
if rootfs {
csc.Rootfs = arg
+ // check if rootfs is actually overlayed
+ parts := strings.SplitN(csc.Rootfs, ":", 2)
+ if len(parts) > 1 && parts[1] == "O" {
+ csc.RootfsOverlay = true
+ csc.Rootfs = parts[0]
+ }
} else {
csc.Image = arg
}