From 4010174f660d4f75a9eef30d28fa1b6352330c50 Mon Sep 17 00:00:00 2001 From: Oscar Zhou <100548325+oscarzhou-portainer@users.noreply.github.com> Date: Wed, 8 Jan 2025 09:45:13 +1300 Subject: [PATCH] fix(docker/volume): failed to list volume before snapshot is created [BE-11544] (#286) --- api/http/proxy/factory/docker/volumes.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/http/proxy/factory/docker/volumes.go b/api/http/proxy/factory/docker/volumes.go index 8faec223c..aae0a4602 100644 --- a/api/http/proxy/factory/docker/volumes.go +++ b/api/http/proxy/factory/docker/volumes.go @@ -224,7 +224,7 @@ func (transport *Transport) getDockerID() (string, error) { if transport.snapshotService != nil { endpoint := portainer.Endpoint{ID: transport.endpoint.ID} - if err := transport.snapshotService.FillSnapshotData(&endpoint); err == nil { + if err := transport.snapshotService.FillSnapshotData(&endpoint); err == nil && len(endpoint.Snapshots) > 0 { if dockerID, err := snapshot.FetchDockerID(endpoint.Snapshots[0]); err == nil { transport.dockerID = dockerID return dockerID, nil