diff options
author | Matthew Heon <matthew.heon@gmail.com> | 2018-05-01 12:08:52 -0400 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-05-03 12:23:12 +0000 |
commit | ab7e2a695633dbe45b0af3332b813b0efdfbf203 (patch) | |
tree | 74de1a9b76fbc3ab628f083561ed60c2576836be /cmd | |
parent | 16c997de624be049dda5d2182ec70d979194b002 (diff) | |
download | podman-ab7e2a695633dbe45b0af3332b813b0efdfbf203.tar.gz podman-ab7e2a695633dbe45b0af3332b813b0efdfbf203.tar.bz2 podman-ab7e2a695633dbe45b0af3332b813b0efdfbf203.zip |
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 <matthew.heon@gmail.com>
Closes: #700
Approved by: rhatdan
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/podman/commit.go | 13 | ||||
-rw-r--r-- | cmd/podman/spec.go | 11 |
2 files changed, 11 insertions, 13 deletions
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 { |