Browse Source

fix docker rm name issue

Addresses https://github.com/docker/docker/issues/12308

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Qiang Huang 10 years ago
parent
commit
79f13d1497
1 changed files with 2 additions and 0 deletions
  1. 2 0
      api/client/rm.go

+ 2 - 0
api/client/rm.go

@@ -3,6 +3,7 @@ package client
 import (
 	"fmt"
 	"net/url"
+	"strings"
 
 	flag "github.com/docker/docker/pkg/mflag"
 )
@@ -36,6 +37,7 @@ func (cli *DockerCli) CmdRm(args ...string) error {
 		if name == "" {
 			return fmt.Errorf("Container name cannot be empty")
 		}
+		name = strings.Trim(name, "/")
 
 		_, _, err := readBody(cli.call("DELETE", "/containers/"+name+"?"+val.Encode(), nil, nil))
 		if err != nil {