Skip to content

Commit

Permalink
Prefix / to the container name is ignored when container is renamed
Browse files Browse the repository at this point in the history
Closes moby#10996

Signed-off-by: Srini Brahmaroutu <[email protected]>
  • Loading branch information
brahmaroutu committed Feb 27, 2015
1 parent 2768ce0 commit caaae78
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ RUN set -x \
go build -o /go/bin/registry-v2 github.com/docker/distribution/cmd/registry

# Get the "docker-py" source so we can run their integration tests
ENV DOCKER_PY_COMMIT d39da1167975aaeb6c423b99621ecda1223477b8
ENV DOCKER_PY_COMMIT 91985b239764fe54714fa0a93d52aa362357d251
RUN git clone https://github.com/docker/docker-py.git /docker-py \
&& cd /docker-py \
&& git checkout -q $DOCKER_PY_COMMIT
Expand Down
2 changes: 1 addition & 1 deletion daemon/rename.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func (daemon *Daemon) ContainerRename(job *engine.Job) engine.Status {

container.Lock()
defer container.Unlock()
if _, err := daemon.reserveName(container.ID, newName); err != nil {
if newName, err = daemon.reserveName(container.ID, newName); err != nil {
return job.Errorf("Error when allocating new name: %s", err)
}

Expand Down
6 changes: 3 additions & 3 deletions integration-cli/docker_cli_rename_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestRenameStoppedContainer(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if name != "new_name" {
if name != "/new_name" {
t.Fatal("Failed to rename container ", name)
}

Expand All @@ -62,7 +62,7 @@ func TestRenameRunningContainer(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if name != "new_name" {
if name != "/new_name" {
t.Fatal("Failed to rename container ")
}

Expand All @@ -88,7 +88,7 @@ func TestRenameCheckNames(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if name != "new_name" {
if name != "/new_name" {
t.Fatal("Failed to rename container ")
}

Expand Down

0 comments on commit caaae78

Please sign in to comment.