summaryrefslogtreecommitdiff
path: root/pkg/specgen
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/specgen')
-rw-r--r--pkg/specgen/generate/container_create.go3
-rw-r--r--pkg/specgen/specgen.go4
2 files changed, 7 insertions, 0 deletions
diff --git a/pkg/specgen/generate/container_create.go b/pkg/specgen/generate/container_create.go
index 9f398a0ed..f3dc28b01 100644
--- a/pkg/specgen/generate/container_create.go
+++ b/pkg/specgen/generate/container_create.go
@@ -378,6 +378,9 @@ func createContainerOptions(ctx context.Context, rt *libpod.Runtime, s *specgen.
if s.WorkDir == "" {
s.WorkDir = "/"
}
+ if s.CreateWorkingDir {
+ options = append(options, libpod.WithCreateWorkingDir())
+ }
if s.StopSignal != nil {
options = append(options, libpod.WithStopSignal(*s.StopSignal))
}
diff --git a/pkg/specgen/specgen.go b/pkg/specgen/specgen.go
index 8a4497130..d777287d7 100644
--- a/pkg/specgen/specgen.go
+++ b/pkg/specgen/specgen.go
@@ -272,6 +272,10 @@ type ContainerStorageConfig struct {
// If unset, the default, /, will be used.
// Optional.
WorkDir string `json:"work_dir,omitempty"`
+ // Create the working directory if it doesn't exist.
+ // If unset, it doesn't create it.
+ // Optional.
+ CreateWorkingDir bool `json:"create_working_dir,omitempty"`
// StorageOpts is the container's storage options
// Optional.
StorageOpts map[string]string `json:"storage_opts,omitempty"`