From 9924956dc88bf91a4d0bf09249ffb4cb960dee01 Mon Sep 17 00:00:00 2001 From: baude Date: Mon, 30 Apr 2018 08:26:31 -0500 Subject: do not commit default volumes from container when performing a container commit, we should not add the default list of volumes for a container to the resulting image. it will cause the resulting image to crash when run subsequently. Signed-off-by: baude Closes: #699 Approved by: mheon --- cmd/podman/commit.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'cmd') diff --git a/cmd/podman/commit.go b/cmd/podman/commit.go index 14b7ddace..105ab2d99 100644 --- a/cmd/podman/commit.go +++ b/cmd/podman/commit.go @@ -1,6 +1,7 @@ package main import ( + "encoding/json" "fmt" "io" "os" @@ -120,7 +121,17 @@ func commitCmd(c *cli.Context) error { Changes: c.StringSlice("change"), Author: c.String("author"), } - newImage, err := ctr.Commit(getContext(), reference, options) + var createArtifact createConfig + artifact, err := ctr.GetArtifact("create-config") + if err == nil { + if err := json.Unmarshal(artifact, &createArtifact); err != nil { + return err + } + } + mounts := getMounts(createArtifact.Volumes, true) + command := createArtifact.Command + entryPoint := createArtifact.Entrypoint + newImage, err := ctr.Commit(getContext(), reference, options, strings.Split(mounts, ","), command, entryPoint) if err != nil { return err } -- cgit v1.2.3-54-g00ecf