summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-08-05 14:48:28 +0200
committerGitHub <noreply@github.com>2020-08-05 14:48:28 +0200
commitd1aaf3362204f860267e2bb58ec419b25edc5800 (patch)
tree9bad0c5881a7a64635543dec8d037afe66121f9e /pkg
parent7a7c8e9911c17e4e1748bbf81ab4df27c78426ab (diff)
parent21421c841159f861dfdfed14d9e0f226a5884cf0 (diff)
downloadpodman-d1aaf3362204f860267e2bb58ec419b25edc5800.tar.gz
podman-d1aaf3362204f860267e2bb58ec419b25edc5800.tar.bz2
podman-d1aaf3362204f860267e2bb58ec419b25edc5800.zip
Merge pull request #7176 from mheon/make_entrypoint
Ensure WORKDIR from images is created
Diffstat (limited to 'pkg')
-rw-r--r--pkg/specgen/generate/container_create.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/pkg/specgen/generate/container_create.go b/pkg/specgen/generate/container_create.go
index 9dfb35be3..b61ac2c30 100644
--- a/pkg/specgen/generate/container_create.go
+++ b/pkg/specgen/generate/container_create.go
@@ -238,6 +238,17 @@ func createContainerOptions(ctx context.Context, rt *libpod.Runtime, s *specgen.
if s.Entrypoint != nil {
options = append(options, libpod.WithEntrypoint(s.Entrypoint))
}
+ // If the user did not set an workdir but the image did, ensure it is
+ // created.
+ if s.WorkDir == "" && img != nil {
+ newWD, err := img.WorkingDir(ctx)
+ if err != nil {
+ return nil, err
+ }
+ if newWD != "" {
+ options = append(options, libpod.WithCreateWorkingDir())
+ }
+ }
if s.StopSignal != nil {
options = append(options, libpod.WithStopSignal(*s.StopSignal))
}