Skip to content

Commit bc1160d

Browse files
ulyssessouzandeloof
authored andcommitted
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 <[email protected]>
1 parent f791bc8 commit bc1160d

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

pkg/compose/create.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,14 +1103,13 @@ func (s *composeService) ensureVolume(ctx context.Context, volume types.VolumeCo
11031103
return nil
11041104
}
11051105

1106-
// Volume exists with name, but let's double check this is the expected one
1107-
// (better safe than sorry when it comes to user's data)
1106+
// Volume exists with name, but let's double-check this is the expected one
11081107
p, ok := inspected.Labels[api.ProjectLabel]
11091108
if !ok {
1110-
return fmt.Errorf("volume %q already exists but was not created by Docker Compose. Use `external: true` to use an existing volume", volume.Name)
1109+
logrus.Warnf("volume %q already exists but was not created by Docker Compose. Use `external: true` to use an existing volume", volume.Name)
11111110
}
1112-
if p != project {
1113-
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)
1111+
if ok && p != project {
1112+
logrus.Warnf("volume %q already exists but was not created for project %q. Use `external: true` to use an existing volume", volume.Name, p)
11141113
}
11151114
return nil
11161115
}

0 commit comments

Comments
 (0)