mirror of
https://github.com/containers/podman.git
synced 2025-07-03 09:17:15 +08:00
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>
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user