diff options
author | Matthew Heon <matthew.heon@pm.me> | 2019-04-10 16:00:47 -0400 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2019-04-11 09:55:24 -0400 |
commit | aef09ce031d169a7a5c0c8460ee6ec231bbf5a11 (patch) | |
tree | bf5693e737dd1d3f8e7f60c59fde536ac8bac70f /libpod | |
parent | 6cd6eb6768bb936e87309c61d9cf131350274700 (diff) | |
download | podman-aef09ce031d169a7a5c0c8460ee6ec231bbf5a11.tar.gz podman-aef09ce031d169a7a5c0c8460ee6ec231bbf5a11.tar.bz2 podman-aef09ce031d169a7a5c0c8460ee6ec231bbf5a11.zip |
Add --include-volumes flag to 'podman commit'
The 'docker commit' will never include a container's volumes when
committing, without an explicit request through '--change'.
Podman, however, defaulted to including user volumes as image
volumes.
Make this behavior depend on a new flag, '--include-volumes',
and make the default behavior match Docker.
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/container_commit.go | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/libpod/container_commit.go b/libpod/container_commit.go index 0604a550b..db67f7a30 100644 --- a/libpod/container_commit.go +++ b/libpod/container_commit.go @@ -20,10 +20,11 @@ import ( //libpod type ContainerCommitOptions struct { buildah.CommitOptions - Pause bool - Author string - Message string - Changes []string + Pause bool + IncludeVolumes bool + Author string + Message string + Changes []string } // ChangeCmds is the list of valid Changes commands to passed to the Commit call @@ -113,9 +114,11 @@ func (c *Container) Commit(ctx context.Context, destImage string, options Contai // User importBuilder.SetUser(c.User()) // Volumes - for _, v := range c.config.UserVolumes { - if v != "" { - importBuilder.AddVolume(v) + if options.IncludeVolumes { + for _, v := range c.config.UserVolumes { + if v != "" { + importBuilder.AddVolume(v) + } } } // Workdir |