diff --git a/commands/remove.go b/commands/remove.go index 7169d54..75b2e7d 100644 --- a/commands/remove.go +++ b/commands/remove.go @@ -15,6 +15,14 @@ func RemoveCommand() *cli.Command { Name: "remove", Usage: "remove containers", Action: run, + Flags: []cli.Flag{ + &cli.BoolFlag{ + Name: "force", + Usage: "ignore or not before stop hook if it was setted and force check", + Aliases: []string{"f"}, + Value: false, + }, + }, } } @@ -23,13 +31,14 @@ func remove(c *cli.Context, conn *grpc.ClientConn) { log.Fatal("[Remove] not specify containers") } client := pb.NewCoreRPCClient(conn) - ids := &pb.ContainerIDs{Ids: []*pb.ContainerID{}} + ids := []string{} for _, id := range c.Args().Slice() { log.Debugf("[Remove] remove %s", id) - ids.Ids = append(ids.Ids, &pb.ContainerID{Id: id}) + ids = append(ids, id) } + opts := &pb.RemoveContainerOptions{Ids: ids, Force: c.Bool("force")} - resp, err := client.RemoveContainer(context.Background(), ids) + resp, err := client.RemoveContainer(context.Background(), opts) if err != nil { log.Fatalf("[Remove] send request failed %v", err) } diff --git a/specs.yaml.example b/specs.yaml.example index d22ca2e..61d3d0d 100644 --- a/specs.yaml.example +++ b/specs.yaml.example @@ -9,14 +9,12 @@ entrypoints: healthcheck: ports: - "80/tcp" - privileged: "1" + privileged: true hook: after_start: - - "ls -al /" - - "env" - before_stop: - "ls -al /tmp" - - "pwd" - force: false + before_stop: + - "abcd" + force: true volumes: - "/tmp:/tmp/host"