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

Commit

Permalink
Merge pull request #341 from docker/better_error_message
Browse files Browse the repository at this point in the history
Better error message when trying to remove a container from a compose application
  • Loading branch information
gtardif authored Jul 3, 2020
2 parents aeb446e + dbc1098 commit f2ff8ab
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion azure/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,8 @@ func (cs *aciContainerService) Logs(ctx context.Context, containerName string, r
func (cs *aciContainerService) Delete(ctx context.Context, containerID string, _ bool) error {
groupName, containerName := getGroupAndContainerName(containerID)
if groupName != containerID {
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))
msg := "cannot delete service %q from compose application %q, you can delete the entire compose app with docker compose down --project-name %s"
return errors.New(fmt.Sprintf(msg, containerName, groupName, groupName))
}
cg, err := deleteACIContainerGroup(ctx, cs.ctx, groupName)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion azure/backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (suite *BackendSuiteTest) TestErrorMessageDeletingContainerFromComposeAppli
err := service.Delete(context.TODO(), "compose-app_service1", false)

Expect(err).NotTo(BeNil())
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"))
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"))
}

func (suite *BackendSuiteTest) TestErrorMessageRunSingleContainerNameWithComposeSeparator() {
Expand Down

0 comments on commit f2ff8ab

Please sign in to comment.