From bc1160de72bd12f0d1444b4e2003df44a38d4801 Mon Sep 17 00:00:00 2001 From: Ulysses Souza Date: Thu, 2 Dec 2021 02:24:02 +0100 Subject: [PATCH] Turn external volume usage into a warning instead of erroring This avoids a compatibility break since returning an error would avoid the project to be started Signed-off-by: Ulysses Souza --- pkg/compose/create.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pkg/compose/create.go b/pkg/compose/create.go index aab2d115..9f3eb08c 100644 --- a/pkg/compose/create.go +++ b/pkg/compose/create.go @@ -1103,14 +1103,13 @@ func (s *composeService) ensureVolume(ctx context.Context, volume types.VolumeCo return nil } - // Volume exists with name, but let's double check this is the expected one - // (better safe than sorry when it comes to user's data) + // Volume exists with name, but let's double-check this is the expected one p, ok := inspected.Labels[api.ProjectLabel] if !ok { - return fmt.Errorf("volume %q already exists but was not created by Docker Compose. Use `external: true` to use an existing volume", volume.Name) + logrus.Warnf("volume %q already exists but was not created by Docker Compose. Use `external: true` to use an existing volume", volume.Name) } - if p != project { - return fmt.Errorf("volume %q already exists but was not created for project %q. Use `external: true` to use an existing volume", volume.Name, p) + if ok && p != project { + logrus.Warnf("volume %q already exists but was not created for project %q. Use `external: true` to use an existing volume", volume.Name, p) } return nil }