diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2020-04-24 11:41:37 +0200 |
---|---|---|
committer | Giuseppe Scrivano <gscrivan@redhat.com> | 2020-04-24 12:56:20 +0200 |
commit | a3acc4f97775a446f93deeb924ab99b708bcfe88 (patch) | |
tree | fd10fd2f5b3be1931074c2b22858479d8035c567 /pkg/specgen/generate/container_create.go | |
parent | 23d431f0bf4ef4e550d23b43264c2ffdc940c767 (diff) | |
download | podman-a3acc4f97775a446f93deeb924ab99b708bcfe88.tar.gz podman-a3acc4f97775a446f93deeb924ab99b708bcfe88.tar.bz2 podman-a3acc4f97775a446f93deeb924ab99b708bcfe88.zip |
podman: add support for --rootfs
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'pkg/specgen/generate/container_create.go')
-rw-r--r-- | pkg/specgen/generate/container_create.go | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/pkg/specgen/generate/container_create.go b/pkg/specgen/generate/container_create.go index 369c64e1f..49a717c5d 100644 --- a/pkg/specgen/generate/container_create.go +++ b/pkg/specgen/generate/container_create.go @@ -7,6 +7,7 @@ import ( "github.com/containers/common/pkg/config" "github.com/containers/libpod/libpod" "github.com/containers/libpod/libpod/define" + "github.com/containers/libpod/libpod/image" "github.com/containers/libpod/pkg/specgen" "github.com/containers/storage" "github.com/pkg/errors" @@ -84,13 +85,16 @@ func MakeContainer(rt *libpod.Runtime, s *specgen.SpecGenerator) (*libpod.Contai return nil, err } options = append(options, createExitCommandOption(s, rt.StorageConfig(), rtc, podmanPath)) - newImage, err := rt.ImageRuntime().NewFromLocal(s.Image) - if err != nil { - return nil, err + var newImage *image.Image + if s.Rootfs != "" { + options = append(options, libpod.WithRootFS(s.Rootfs)) + } else { + newImage, err = rt.ImageRuntime().NewFromLocal(s.Image) + if err != nil { + return nil, err + } + options = append(options, libpod.WithRootFSFromImage(newImage.ID(), s.Image, s.RawImageName)) } - - options = append(options, libpod.WithRootFSFromImage(newImage.ID(), s.Image, s.RawImageName)) - if err := s.Validate(); err != nil { return nil, errors.Wrap(err, "invalid config provided") } |