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
12 changes: 6 additions & 6 deletions cli/command/container/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (
type fakeClient struct {
client.Client
inspectFunc func(string) (container.InspectResponse, error)
execInspectFunc func(execID string) (container.ExecInspect, error)
execCreateFunc func(containerID string, options container.ExecOptions) (container.ExecCreateResponse, error)
execInspectFunc func(execID string) (client.ExecInspect, error)
execCreateFunc func(containerID string, options client.ExecCreateOptions) (container.ExecCreateResponse, error)
createContainerFunc func(config *container.Config,
hostConfig *container.HostConfig,
networkingConfig *network.NetworkingConfig,
Expand Down Expand Up @@ -59,21 +59,21 @@ func (f *fakeClient) ContainerInspect(_ context.Context, containerID string) (co
return container.InspectResponse{}, nil
}

func (f *fakeClient) ContainerExecCreate(_ context.Context, containerID string, config container.ExecOptions) (container.ExecCreateResponse, error) {
func (f *fakeClient) ContainerExecCreate(_ context.Context, containerID string, config client.ExecCreateOptions) (container.ExecCreateResponse, error) {
if f.execCreateFunc != nil {
return f.execCreateFunc(containerID, config)
}
return container.ExecCreateResponse{}, nil
}

func (f *fakeClient) ContainerExecInspect(_ context.Context, execID string) (container.ExecInspect, error) {
func (f *fakeClient) ContainerExecInspect(_ context.Context, execID string) (client.ExecInspect, error) {
if f.execInspectFunc != nil {
return f.execInspectFunc(execID)
}
return container.ExecInspect{}, nil
return client.ExecInspect{}, nil
}

func (*fakeClient) ContainerExecStart(context.Context, string, container.ExecStartOptions) error {
func (*fakeClient) ContainerExecStart(context.Context, string, client.ExecStartOptions) error {
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion cli/command/container/commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func runCommit(ctx context.Context, dockerCli command.Cli, options *commitOption
Comment: options.comment,
Author: options.author,
Changes: options.changes.GetSlice(),
Pause: !options.noPause,
NoPause: options.noPause,
})
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion cli/command/container/commit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestRunCommit(t *testing.T) {
assert.Check(t, is.Equal(options.Author, "Author Name <author@name.com>"))
assert.Check(t, is.DeepEqual(options.Changes, []string{"EXPOSE 80"}))
assert.Check(t, is.Equal(options.Comment, "commit message"))
assert.Check(t, is.Equal(options.Pause, false))
assert.Check(t, is.Equal(options.NoPause, true))
assert.Check(t, is.Equal(ctr, "container-id"))

return container.CommitResponse{ID: "image-id"}, nil
Expand Down
12 changes: 6 additions & 6 deletions cli/command/container/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func RunExec(ctx context.Context, dockerCLI command.Cli, containerIDorName strin
}

if options.Detach {
return apiClient.ContainerExecStart(ctx, execID, container.ExecStartOptions{
return apiClient.ContainerExecStart(ctx, execID, client.ExecStartOptions{
Detach: options.Detach,
Tty: execOptions.Tty,
ConsoleSize: execOptions.ConsoleSize,
Expand All @@ -128,14 +128,14 @@ func RunExec(ctx context.Context, dockerCLI command.Cli, containerIDorName strin
return interactiveExec(ctx, dockerCLI, execOptions, execID)
}

func fillConsoleSize(execOptions *container.ExecOptions, dockerCli command.Cli) {
func fillConsoleSize(execOptions *client.ExecCreateOptions, dockerCli command.Cli) {
if execOptions.Tty {
height, width := dockerCli.Out().GetTtySize()
execOptions.ConsoleSize = &[2]uint{height, width}
}
}

func interactiveExec(ctx context.Context, dockerCli command.Cli, execOptions *container.ExecOptions, execID string) error {
func interactiveExec(ctx context.Context, dockerCli command.Cli, execOptions *client.ExecCreateOptions, execID string) error {
// Interactive exec requested.
var (
out, stderr io.Writer
Expand All @@ -158,7 +158,7 @@ func interactiveExec(ctx context.Context, dockerCli command.Cli, execOptions *co
fillConsoleSize(execOptions, dockerCli)

apiClient := dockerCli.Client()
resp, err := apiClient.ContainerExecAttach(ctx, execID, container.ExecAttachOptions{
resp, err := apiClient.ContainerExecAttach(ctx, execID, client.ExecAttachOptions{
Tty: execOptions.Tty,
ConsoleSize: execOptions.ConsoleSize,
})
Expand Down Expand Up @@ -218,8 +218,8 @@ func getExecExitStatus(ctx context.Context, apiClient client.ContainerAPIClient,

// parseExec parses the specified args for the specified command and generates
// an ExecConfig from it.
func parseExec(execOpts ExecOptions, configFile *configfile.ConfigFile) (*container.ExecOptions, error) {
execOptions := &container.ExecOptions{
func parseExec(execOpts ExecOptions, configFile *configfile.ConfigFile) (*client.ExecCreateOptions, error) {
execOptions := &client.ExecCreateOptions{
User: execOpts.User,
Privileged: execOpts.Privileged,
Tty: execOpts.TTY,
Expand Down
27 changes: 14 additions & 13 deletions cli/command/container/exec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/docker/cli/internal/test"
"github.com/docker/cli/opts"
"github.com/moby/moby/api/types/container"
"github.com/moby/moby/client"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
"gotest.tools/v3/fs"
Expand All @@ -38,18 +39,18 @@ TWO=2
testcases := []struct {
options ExecOptions
configFile configfile.ConfigFile
expected container.ExecOptions
expected client.ExecCreateOptions
}{
{
expected: container.ExecOptions{
expected: client.ExecCreateOptions{
Cmd: []string{"command"},
AttachStdout: true,
AttachStderr: true,
},
options: withDefaultOpts(ExecOptions{}),
},
{
expected: container.ExecOptions{
expected: client.ExecCreateOptions{
Cmd: []string{"command1", "command2"},
AttachStdout: true,
AttachStderr: true,
Expand All @@ -64,7 +65,7 @@ TWO=2
TTY: true,
User: "uid",
}),
expected: container.ExecOptions{
expected: client.ExecCreateOptions{
User: "uid",
AttachStdin: true,
AttachStdout: true,
Expand All @@ -75,7 +76,7 @@ TWO=2
},
{
options: withDefaultOpts(ExecOptions{Detach: true}),
expected: container.ExecOptions{
expected: client.ExecCreateOptions{
Cmd: []string{"command"},
},
},
Expand All @@ -85,15 +86,15 @@ TWO=2
Interactive: true,
Detach: true,
}),
expected: container.ExecOptions{
expected: client.ExecCreateOptions{
Tty: true,
Cmd: []string{"command"},
},
},
{
options: withDefaultOpts(ExecOptions{Detach: true}),
configFile: configfile.ConfigFile{DetachKeys: "de"},
expected: container.ExecOptions{
expected: client.ExecCreateOptions{
Cmd: []string{"command"},
DetachKeys: "de",
},
Expand All @@ -104,13 +105,13 @@ TWO=2
DetachKeys: "ab",
}),
configFile: configfile.ConfigFile{DetachKeys: "de"},
expected: container.ExecOptions{
expected: client.ExecCreateOptions{
Cmd: []string{"command"},
DetachKeys: "ab",
},
},
{
expected: container.ExecOptions{
expected: client.ExecCreateOptions{
Cmd: []string{"command"},
AttachStdout: true,
AttachStderr: true,
Expand All @@ -123,7 +124,7 @@ TWO=2
}(),
},
{
expected: container.ExecOptions{
expected: client.ExecCreateOptions{
Cmd: []string{"command"},
AttachStdout: true,
AttachStderr: true,
Expand Down Expand Up @@ -206,7 +207,7 @@ func TestRunExec(t *testing.T) {
}
}

func execCreateWithID(_ string, _ container.ExecOptions) (container.ExecCreateResponse, error) {
func execCreateWithID(_ string, _ client.ExecCreateOptions) (container.ExecCreateResponse, error) {
return container.ExecCreateResponse{ID: "execid"}, nil
}

Expand Down Expand Up @@ -235,9 +236,9 @@ func TestGetExecExitStatus(t *testing.T) {

for _, testcase := range testcases {
apiClient := &fakeClient{
execInspectFunc: func(id string) (container.ExecInspect, error) {
execInspectFunc: func(id string) (client.ExecInspect, error) {
assert.Check(t, is.Equal(execID, id))
return container.ExecInspect{ExitCode: testcase.exitCode}, testcase.inspectError
return client.ExecInspect{ExitCode: testcase.exitCode}, testcase.inspectError
},
}
err := getExecExitStatus(context.Background(), apiClient, execID)
Expand Down
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.16
github.com/moby/go-archive v0.1.0
github.com/moby/moby/api v1.52.0-beta.1
github.com/moby/moby/client v0.1.0-beta.0
github.com/moby/moby/api v1.52.0-beta.1.0.20250923190348-e98849831fc4 // master
github.com/moby/moby/client v0.1.0-beta.0.0.20250923190348-e98849831fc4 // master
github.com/moby/patternmatcher v0.6.0
github.com/moby/swarmkit/v2 v2.0.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.1 h1:r5U4U72E7xSHh4zX72ndY1mA/FOGiAPiGiz2a8rBW+w=
github.com/moby/moby/api v1.52.0-beta.1/go.mod h1:8sBV0soUREiudtow4vqJGOxa4GyHI5vLQmvgKdHq5Ok=
github.com/moby/moby/client v0.1.0-beta.0 h1:eXzrwi0YkzLvezOBKHafvAWNmH1B9HFh4n13yb2QgFE=
github.com/moby/moby/client v0.1.0-beta.0/go.mod h1:irAv8jRi4yKKBeND96Y+3AM9ers+KaJYk9Vmcm7loxs=
github.com/moby/moby/api v1.52.0-beta.1.0.20250923190348-e98849831fc4 h1:nwVKjkAlQJp32lsr/TZ4dGUIkj+Ga6ftle+IVov9HYs=
github.com/moby/moby/api v1.52.0-beta.1.0.20250923190348-e98849831fc4/go.mod h1:8sBV0soUREiudtow4vqJGOxa4GyHI5vLQmvgKdHq5Ok=
github.com/moby/moby/client v0.1.0-beta.0.0.20250923190348-e98849831fc4 h1:fk0TcJJf4rrgD3I35xxPkb9R4S+KCToMNomydm/n2Pg=
github.com/moby/moby/client v0.1.0-beta.0.0.20250923190348-e98849831fc4/go.mod h1:o5CkJu0RlmnLWRZRaEd7fL6wo0Ggr8Hw/UvgqdIUBuI=
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.0.0 h1:jkWQKQaJ4ltA61/mC9UdPe1McLma55RUcacTO+pPweY=
Expand Down
50 changes: 0 additions & 50 deletions vendor/github.com/moby/moby/api/types/container/exec.go

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

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

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

3 changes: 0 additions & 3 deletions vendor/github.com/moby/moby/api/types/container/hostconfig.go

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

Loading
Loading