mirror of
https://github.com/containers/podman.git
synced 2025-10-25 02:04:43 +08:00
Merge pull request #16243 from alexlarsson/volume-create-ignore
Add podman volume create --ignore
This commit is contained in:
@ -19,6 +19,8 @@ type VolumeCreateOptions struct {
|
||||
Labels map[string]string `schema:"labels"`
|
||||
// Mapping of driver options and values.
|
||||
Options map[string]string `schema:"opts"`
|
||||
// Ignore existing volumes
|
||||
IgnoreIfExists bool `schema:"ignoreIfExist"`
|
||||
}
|
||||
|
||||
type VolumeConfigResponse struct {
|
||||
|
||||
@ -33,6 +33,11 @@ func (ic *ContainerEngine) VolumeCreate(ctx context.Context, opts entities.Volum
|
||||
}
|
||||
volumeOptions = append(volumeOptions, parsedOptions...)
|
||||
}
|
||||
|
||||
if opts.IgnoreIfExists {
|
||||
volumeOptions = append(volumeOptions, libpod.WithVolumeIgnoreIfExist())
|
||||
}
|
||||
|
||||
vol, err := ic.Libpod.NewVolume(ctx, volumeOptions...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user