From 85f52d2574be32a6a6cbf8fcca4e7105c9d16b9c Mon Sep 17 00:00:00 2001 From: LP B Date: Tue, 31 Dec 2024 22:44:49 +0100 Subject: [PATCH] feat(app/stack): ability to prune volumes on stack/edge stack delete (#232) Co-authored-by: oscarzhou --- api/edge/edge.go | 7 ++++++- api/portainer.go | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/api/edge/edge.go b/api/edge/edge.go index c380f4f8d..d204a3b63 100644 --- a/api/edge/edge.go +++ b/api/edge/edge.go @@ -64,9 +64,14 @@ type ( DeployerOptionsPayload struct { // Prune is a flag indicating if the agent must prune the containers or not when creating/updating an edge stack - // This flag drives docker compose `--remove-orphans` and docker stack `--prune` options + // This flag drives `docker compose up --remove-orphans` and `docker stack up --prune` options // Used only for EE Prune bool + // RemoveVolumes is a flag indicating if the agent must remove the named volumes declared + // in the compose file and anonymouse volumes attached to containers + // This flag drives `docker compose down --volumes` option + // Used only for EE + RemoveVolumes bool } // RegistryCredentials holds the credentials for a Docker registry. diff --git a/api/portainer.go b/api/portainer.go index 73da24073..b507e6290 100644 --- a/api/portainer.go +++ b/api/portainer.go @@ -1395,6 +1395,13 @@ type ( Prune bool } + ComposeDownOptions struct { + // RemoveVolumes will remove the named volumes declared in the compose file + // and anonymous volumes attached to the stack's containers + // Drives `docker compose down --volumes` + RemoveVolumes bool + } + ComposeRunOptions struct { ComposeOptions