summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2021-04-27 09:22:32 -0400
committerDaniel J Walsh <dwalsh@redhat.com>2021-04-27 10:32:06 -0400
commit825c84efe1feaf95e63476db6b9c69510e1b87de (patch)
tree5c1dcd1bc18718a3d423a2b4523b4d8180ec2b88 /pkg
parent3148e01651e939f345242d582d82a068d1c6dd7e (diff)
downloadpodman-825c84efe1feaf95e63476db6b9c69510e1b87de.tar.gz
podman-825c84efe1feaf95e63476db6b9c69510e1b87de.tar.bz2
podman-825c84efe1feaf95e63476db6b9c69510e1b87de.zip
Allow docker volume create API to pass without name
The Docker API does not require Volume name to be specified when creating a volume. Fixes: https://github.com/containers/podman/issues/9803 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'pkg')
-rw-r--r--pkg/api/handlers/compat/volumes.go16
1 files changed, 11 insertions, 5 deletions
diff --git a/pkg/api/handlers/compat/volumes.go b/pkg/api/handlers/compat/volumes.go
index d86fc1e19..1ff1468e7 100644
--- a/pkg/api/handlers/compat/volumes.go
+++ b/pkg/api/handlers/compat/volumes.go
@@ -96,11 +96,17 @@ func CreateVolume(w http.ResponseWriter, r *http.Request) {
return
}
- // See if the volume exists already
- existingVolume, err := runtime.GetVolume(input.Name)
- if err != nil && errors.Cause(err) != define.ErrNoSuchVolume {
- utils.InternalServerError(w, err)
- return
+ var (
+ existingVolume *libpod.Volume
+ err error
+ )
+ if len(input.Name) != 0 {
+ // See if the volume exists already
+ existingVolume, err = runtime.GetVolume(input.Name)
+ if err != nil && errors.Cause(err) != define.ErrNoSuchVolume {
+ utils.InternalServerError(w, err)
+ return
+ }
}
// if using the compat layer and the volume already exists, we