docker serve: make Create idempotent to avoid "volume already exists" after restart

Docker may re-send Create requests for volumes that already exist,
especially after a plugin restart. Previously this returned
ErrVolumeExists which Docker surfaced as "volume name must be unique".

Now if a volume with the same name already exists, Create returns
success (no-op), matching the Docker volume plugin protocol's
expectation of idempotent operations.
This commit is contained in:
Nick Craig-Wood
2026-07-13 15:30:03 +01:00
parent 8bfe94770a
commit 7a5175f223
3 changed files with 13 additions and 7 deletions
-1
View File
@@ -20,7 +20,6 @@ import (
// Errors
var (
ErrVolumeNotFound = errors.New("volume not found")
ErrVolumeExists = errors.New("volume already exists")
ErrMountpointExists = errors.New("non-empty mountpoint already exists")
)