Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions cli/command/container/rename.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package container

import (
"errors"
"fmt"

"github.com/docker/cli/cli"
Expand All @@ -19,10 +18,6 @@ func newRenameCommand(dockerCLI command.Cli) *cobra.Command {
Args: cli.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
oldName, newName := args[0], args[1]
if newName == "" {
// TODO(thaJeztah): remove once https://github.com/moby/moby/pull/51336 is merged and vendored.
return errors.New("new name cannot be blank")
}
_, err := dockerCLI.Client().ContainerRename(cmd.Context(), oldName, client.ContainerRenameOptions{
NewName: newName,
})
Expand Down
62 changes: 0 additions & 62 deletions cli/command/container/rename_test.go

This file was deleted.

2 changes: 1 addition & 1 deletion cli/command/registry/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ func loginClientSide(ctx context.Context, options client.RegistryLoginOptions) (
}

return client.RegistryLoginResult{
Auth: registrytypes.AuthenticateOKBody{
Auth: registrytypes.AuthResponse{
Status: "Login Succeeded",
IdentityToken: token,
},
Expand Down
2 changes: 1 addition & 1 deletion cli/command/registry/login_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (*fakeClient) RegistryLogin(_ context.Context, options client.RegistryLogin
}
if options.Password == useToken {
return client.RegistryLoginResult{
Auth: registrytypes.AuthenticateOKBody{IdentityToken: options.Password},
Auth: registrytypes.AuthResponse{IdentityToken: options.Password},
}, nil
}
if options.Username == unknownUser {
Expand Down
24 changes: 24 additions & 0 deletions e2e/container/rename_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,27 @@ func TestContainerRename(t *testing.T) {
res.Assert(t, icmd.Success)
assert.Equal(t, "/"+newName, strings.TrimSpace(res.Stdout()))
}

func TestContainerRenameEmptyOldName(t *testing.T) {
res := icmd.RunCommand("docker", "container", "rename", "", "newName")
res.Assert(t, icmd.Expected{
ExitCode: 1,
Err: "invalid container name or ID: value is empty",
})
}

func TestContainerRenameEmptyNewName(t *testing.T) {
oldName := "old_name_" + t.Name()
res := icmd.RunCommand("docker", "run", "-d", "--name", oldName, fixtures.AlpineImage, "sleep", "60")
res.Assert(t, icmd.Success)
cID := strings.TrimSpace(res.Stdout())
t.Cleanup(func() {
icmd.RunCommand("docker", "container", "rm", "-f", cID).Assert(t, icmd.Success)
})

res = icmd.RunCommand("docker", "container", "rename", oldName, "")
res.Assert(t, icmd.Expected{
ExitCode: 1,
Err: "new name cannot be blank",
})
}
4 changes: 2 additions & 2 deletions vendor.mod
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ require (
github.com/google/uuid v1.6.0
github.com/mattn/go-runewidth v0.0.17
github.com/moby/go-archive v0.1.0
github.com/moby/moby/api v1.52.0-beta.2.0.20251029165853-ef17deb3a0fb // master
github.com/moby/moby/client v0.1.0-beta.2.0.20251029165853-ef17deb3a0fb // master
github.com/moby/moby/api v1.52.0-beta.2.0.20251029225139-7a97e1cb401f // master
github.com/moby/moby/client v0.1.0-beta.2.0.20251029225139-7a97e1cb401f // master
github.com/moby/patternmatcher v0.6.0
github.com/moby/swarmkit/v2 v2.1.0
github.com/moby/sys/atomicwriter v0.1.0
Expand Down
8 changes: 4 additions & 4 deletions vendor.sum
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,10 @@ github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3N
github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo=
github.com/moby/go-archive v0.1.0 h1:Kk/5rdW/g+H8NHdJW2gsXyZ7UnzvJNOy6VKJqueWdcQ=
github.com/moby/go-archive v0.1.0/go.mod h1:G9B+YoujNohJmrIYFBpSd54GTUB4lt9S+xVQvsJyFuo=
github.com/moby/moby/api v1.52.0-beta.2.0.20251029165853-ef17deb3a0fb h1:t4RxpXuvv26rIVUBqUm0xgmaSmmTJTv5fzEDxg5piWE=
github.com/moby/moby/api v1.52.0-beta.2.0.20251029165853-ef17deb3a0fb/go.mod h1:v0K/motq8oWmx+rtApG1rBTIpQ8KUONUjpf+U73gags=
github.com/moby/moby/client v0.1.0-beta.2.0.20251029165853-ef17deb3a0fb h1:3F0iF/yIxE43JcK3rJp4k/TsVmfvFMgRyGT/tg+K1xI=
github.com/moby/moby/client v0.1.0-beta.2.0.20251029165853-ef17deb3a0fb/go.mod h1:1YrJTvhL771Q4xiwwe72NSS17lgsCF67xu8fEfSd77g=
github.com/moby/moby/api v1.52.0-beta.2.0.20251029225139-7a97e1cb401f h1:agkZxo7k3fXBqdq6leYCCv0K45OjkH/H3fzPjwcoDkY=
github.com/moby/moby/api v1.52.0-beta.2.0.20251029225139-7a97e1cb401f/go.mod h1:v0K/motq8oWmx+rtApG1rBTIpQ8KUONUjpf+U73gags=
github.com/moby/moby/client v0.1.0-beta.2.0.20251029225139-7a97e1cb401f h1:I0uikdmKsCbOxQV+DIn7gyY8bD0d19g8920FuxI9l3E=
github.com/moby/moby/client v0.1.0-beta.2.0.20251029225139-7a97e1cb401f/go.mod h1:1YrJTvhL771Q4xiwwe72NSS17lgsCF67xu8fEfSd77g=
github.com/moby/patternmatcher v0.6.0 h1:GmP9lR19aU5GqSSFko+5pRqHi+Ohk1O69aFiKkVGiPk=
github.com/moby/patternmatcher v0.6.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc=
github.com/moby/swarmkit/v2 v2.1.0 h1:u+cJ5hSyF3HnzsyI+NtegYxdIPQIuibk7IbpXNxuISM=
Expand Down
21 changes: 21 additions & 0 deletions vendor/github.com/moby/moby/api/types/registry/auth_response.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 0 additions & 21 deletions vendor/github.com/moby/moby/api/types/registry/authenticate.go

This file was deleted.

28 changes: 20 additions & 8 deletions vendor/github.com/moby/moby/client/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions vendor/github.com/moby/moby/client/container_rename.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions vendor/github.com/moby/moby/client/login.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ github.com/moby/docker-image-spec/specs-go/v1
github.com/moby/go-archive
github.com/moby/go-archive/compression
github.com/moby/go-archive/tarheader
# github.com/moby/moby/api v1.52.0-beta.2.0.20251029165853-ef17deb3a0fb
# github.com/moby/moby/api v1.52.0-beta.2.0.20251029225139-7a97e1cb401f
## explicit; go 1.23.0
github.com/moby/moby/api/pkg/authconfig
github.com/moby/moby/api/pkg/stdcopy
Expand All @@ -190,7 +190,7 @@ github.com/moby/moby/api/types/storage
github.com/moby/moby/api/types/swarm
github.com/moby/moby/api/types/system
github.com/moby/moby/api/types/volume
# github.com/moby/moby/client v0.1.0-beta.2.0.20251029165853-ef17deb3a0fb
# github.com/moby/moby/client v0.1.0-beta.2.0.20251029225139-7a97e1cb401f
## explicit; go 1.23.0
github.com/moby/moby/client
github.com/moby/moby/client/internal
Expand Down