Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Commit f2ff8ab

Browse files
authored
Merge pull request #341 from docker/better_error_message
Better error message when trying to remove a container from a compose application
2 parents aeb446e + dbc1098 commit f2ff8ab

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

azure/backend.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,8 @@ func (cs *aciContainerService) Logs(ctx context.Context, containerName string, r
267267
func (cs *aciContainerService) Delete(ctx context.Context, containerID string, _ bool) error {
268268
groupName, containerName := getGroupAndContainerName(containerID)
269269
if groupName != containerID {
270-
return errors.New(fmt.Sprintf("cannot delete service %q from compose app %q, you must delete the entire compose app with docker compose down", containerName, groupName))
270+
msg := "cannot delete service %q from compose application %q, you can delete the entire compose app with docker compose down --project-name %s"
271+
return errors.New(fmt.Sprintf(msg, containerName, groupName, groupName))
271272
}
272273
cg, err := deleteACIContainerGroup(ctx, cs.ctx, groupName)
273274
if err != nil {

azure/backend_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func (suite *BackendSuiteTest) TestErrorMessageDeletingContainerFromComposeAppli
5050
err := service.Delete(context.TODO(), "compose-app_service1", false)
5151

5252
Expect(err).NotTo(BeNil())
53-
Expect(err.Error()).To(Equal("cannot delete service \"service1\" from compose app \"compose-app\", you must delete the entire compose app with docker compose down"))
53+
Expect(err.Error()).To(Equal("cannot delete service \"service1\" from compose application \"compose-app\", you can delete the entire compose app with docker compose down --project-name compose-app"))
5454
}
5555

5656
func (suite *BackendSuiteTest) TestErrorMessageRunSingleContainerNameWithComposeSeparator() {

0 commit comments

Comments
 (0)