From ab7e2a695633dbe45b0af3332b813b0efdfbf203 Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Tue, 1 May 2018 12:08:52 -0400 Subject: Store user Volumes, Entrypoint, Command in database We need these for commit, and they cannot be properly deduced from just the OCI spec, so save them in the database so we can retrieve them for commit. Signed-off-by: Matthew Heon Closes: #700 Approved by: rhatdan --- cmd/podman/commit.go | 13 +------------ cmd/podman/spec.go | 11 ++++++++++- 2 files changed, 11 insertions(+), 13 deletions(-) (limited to 'cmd/podman') diff --git a/cmd/podman/commit.go b/cmd/podman/commit.go index 105ab2d99..14b7ddace 100644 --- a/cmd/podman/commit.go +++ b/cmd/podman/commit.go @@ -1,7 +1,6 @@ package main import ( - "encoding/json" "fmt" "io" "os" @@ -121,17 +120,7 @@ func commitCmd(c *cli.Context) error { Changes: c.StringSlice("change"), Author: c.String("author"), } - 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) + newImage, err := ctr.Commit(getContext(), reference, options) if err != nil { return err } diff --git a/cmd/podman/spec.go b/cmd/podman/spec.go index fbe611cc3..e807ab642 100644 --- a/cmd/podman/spec.go +++ b/cmd/podman/spec.go @@ -653,9 +653,18 @@ func (c *createConfig) GetContainerCreateOptions() ([]libpod.CtrCreateOption, er } if len(c.Volumes) != 0 { - options = append(options, libpod.WithUserVolumes()) + options = append(options, libpod.WithUserVolumes(c.Volumes)) } + if len(c.Command) != 0 { + options = append(options, libpod.WithCommand(c.Command)) + } + + // Add entrypoint unconditionally + // If it's empty it's because it was explicitly set to "" or the image + // does not have one + options = append(options, libpod.WithEntrypoint(c.Entrypoint)) + if c.NetMode.IsContainer() { connectedCtr, err := c.Runtime.LookupContainer(c.NetMode.ConnectedContainer()) if err != nil { -- cgit v1.2.3-54-g00ecf