Skip to content

Commit 88163af

Browse files
committed
vendor: github.com/moby/moby/api, moby/moby/client master
Signed-off-by: Rob Murray <[email protected]>
1 parent 4afbd61 commit 88163af

File tree

14 files changed

+122
-87
lines changed

14 files changed

+122
-87
lines changed

cli/command/container/attach.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,21 @@ type AttachOptions struct {
2323
}
2424

2525
func inspectContainerAndCheckState(ctx context.Context, apiClient client.APIClient, args string) (*container.InspectResponse, error) {
26-
c, err := apiClient.ContainerInspect(ctx, args)
26+
c, err := apiClient.ContainerInspect(ctx, args, client.ContainerInspectOptions{})
2727
if err != nil {
2828
return nil, err
2929
}
30-
if !c.State.Running {
30+
if !c.Container.State.Running {
3131
return nil, errors.New("cannot attach to a stopped container, start it first")
3232
}
33-
if c.State.Paused {
33+
if c.Container.State.Paused {
3434
return nil, errors.New("cannot attach to a paused container, unpause it first")
3535
}
36-
if c.State.Restarting {
36+
if c.Container.State.Restarting {
3737
return nil, errors.New("cannot attach to a restarting container, wait until it is running")
3838
}
3939

40-
return &c, nil
40+
return &c.Container, nil
4141
}
4242

4343
// newAttachCommand creates a new cobra.Command for `docker attach`

cli/command/container/exec.go

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ func RunExec(ctx context.Context, dockerCLI command.Cli, containerIDorName strin
9797
// otherwise if we error out we will leak execIDs on the server (and
9898
// there's no easy way to clean those up). But also in order to make "not
9999
// exist" errors take precedence we do a dummy inspect first.
100-
if _, err := apiClient.ContainerInspect(ctx, containerIDorName); err != nil {
100+
if _, err := apiClient.ContainerInspect(ctx, containerIDorName, client.ContainerInspectOptions{}); err != nil {
101101
return err
102102
}
103103
if !options.Detach {
@@ -119,10 +119,17 @@ func RunExec(ctx context.Context, dockerCLI command.Cli, containerIDorName strin
119119
}
120120

121121
if options.Detach {
122+
var cs client.ConsoleSize
123+
if execOptions.ConsoleSize != nil {
124+
cs = client.ConsoleSize{
125+
Height: execOptions.ConsoleSize[0],
126+
Width: execOptions.ConsoleSize[1],
127+
}
128+
}
122129
_, err := apiClient.ExecStart(ctx, execID, client.ExecStartOptions{
123130
Detach: options.Detach,
124-
Tty: execOptions.Tty,
125-
ConsoleSize: execOptions.ConsoleSize,
131+
TTY: execOptions.Tty,
132+
ConsoleSize: cs,
126133
})
127134
return err
128135
}
@@ -159,9 +166,16 @@ func interactiveExec(ctx context.Context, dockerCli command.Cli, execOptions *cl
159166
fillConsoleSize(execOptions, dockerCli)
160167

161168
apiClient := dockerCli.Client()
169+
var cs client.ConsoleSize
170+
if execOptions.ConsoleSize != nil {
171+
cs = client.ConsoleSize{
172+
Height: execOptions.ConsoleSize[0],
173+
Width: execOptions.ConsoleSize[1],
174+
}
175+
}
162176
resp, err := apiClient.ExecAttach(ctx, execID, client.ExecAttachOptions{
163-
Tty: execOptions.Tty,
164-
ConsoleSize: execOptions.ConsoleSize,
177+
TTY: execOptions.Tty,
178+
ConsoleSize: cs,
165179
})
166180
if err != nil {
167181
return err

cli/command/container/inspect.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"github.com/docker/cli/cli/command/completion"
1212
"github.com/docker/cli/cli/command/inspect"
1313
flagsHelper "github.com/docker/cli/cli/flags"
14+
"github.com/moby/moby/client"
1415
"github.com/spf13/cobra"
1516
)
1617

@@ -46,6 +47,10 @@ func newInspectCommand(dockerCLI command.Cli) *cobra.Command {
4647
func runInspect(ctx context.Context, dockerCLI command.Cli, opts inspectOptions) error {
4748
apiClient := dockerCLI.Client()
4849
return inspect.Inspect(dockerCLI.Out(), opts.refs, opts.format, func(ref string) (any, []byte, error) {
49-
return apiClient.ContainerInspectWithRaw(ctx, ref, opts.size)
50+
res, err := apiClient.ContainerInspect(ctx, ref, client.ContainerInspectOptions{Size: opts.size})
51+
if err != nil {
52+
return nil, nil, err
53+
}
54+
return &res.Container, nil, nil
5055
})
5156
}

cli/command/container/logs.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ func newLogsCommand(dockerCLI command.Cli) *cobra.Command {
5454
}
5555

5656
func runLogs(ctx context.Context, dockerCli command.Cli, opts *logsOptions) error {
57-
c, err := dockerCli.Client().ContainerInspect(ctx, opts.container)
57+
c, err := dockerCli.Client().ContainerInspect(ctx, opts.container, client.ContainerInspectOptions{})
5858
if err != nil {
5959
return err
6060
}
6161

62-
responseBody, err := dockerCli.Client().ContainerLogs(ctx, c.ID, client.ContainerLogsOptions{
62+
responseBody, err := dockerCli.Client().ContainerLogs(ctx, c.Container.ID, client.ContainerLogsOptions{
6363
ShowStdout: true,
6464
ShowStderr: true,
6565
Since: opts.since,
@@ -74,7 +74,7 @@ func runLogs(ctx context.Context, dockerCli command.Cli, opts *logsOptions) erro
7474
}
7575
defer responseBody.Close()
7676

77-
if c.Config.Tty {
77+
if c.Container.Config.Tty {
7878
_, err = io.Copy(dockerCli.Out(), responseBody)
7979
} else {
8080
_, err = stdcopy.StdCopy(dockerCli.Out(), dockerCli.Err(), responseBody)

cli/command/container/port.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"github.com/docker/cli/cli/command/completion"
1313
"github.com/fvbommel/sortorder"
1414
"github.com/moby/moby/api/types/network"
15+
"github.com/moby/moby/client"
1516
"github.com/spf13/cobra"
1617
)
1718

@@ -52,7 +53,7 @@ func newPortCommand(dockerCLI command.Cli) *cobra.Command {
5253
// proto is specified. We should consider changing this to "any" protocol
5354
// for the given private port.
5455
func runPort(ctx context.Context, dockerCli command.Cli, opts *portOptions) error {
55-
c, err := dockerCli.Client().ContainerInspect(ctx, opts.container)
56+
c, err := dockerCli.Client().ContainerInspect(ctx, opts.container, client.ContainerInspectOptions{})
5657
if err != nil {
5758
return err
5859
}
@@ -63,15 +64,15 @@ func runPort(ctx context.Context, dockerCli command.Cli, opts *portOptions) erro
6364
if err != nil {
6465
return err
6566
}
66-
frontends, exists := c.NetworkSettings.Ports[port]
67+
frontends, exists := c.Container.NetworkSettings.Ports[port]
6768
if !exists || len(frontends) == 0 {
6869
return fmt.Errorf("no public port '%s' published for %s", opts.port, opts.container)
6970
}
7071
for _, frontend := range frontends {
7172
out = append(out, net.JoinHostPort(frontend.HostIP.String(), frontend.HostPort))
7273
}
7374
} else {
74-
for from, frontends := range c.NetworkSettings.Ports {
75+
for from, frontends := range c.Container.NetworkSettings.Ports {
7576
for _, frontend := range frontends {
7677
out = append(out, fmt.Sprintf("%s -> %s", from, net.JoinHostPort(frontend.HostIP.String(), frontend.HostPort)))
7778
}

cli/command/container/start.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,16 @@ func RunStart(ctx context.Context, dockerCli command.Cli, opts *StartOptions) er
8080

8181
// 2. Attach to the container.
8282
ctr := opts.Containers[0]
83-
c, err := dockerCli.Client().ContainerInspect(ctx, ctr)
83+
c, err := dockerCli.Client().ContainerInspect(ctx, ctr, client.ContainerInspectOptions{})
8484
if err != nil {
8585
return err
8686
}
8787

8888
// We always use c.ID instead of container to maintain consistency during `docker start`
89-
if !c.Config.Tty {
89+
if !c.Container.Config.Tty {
9090
sigc := notifyAllSignals()
9191
bgCtx := context.WithoutCancel(ctx)
92-
go ForwardAllSignals(bgCtx, dockerCli.Client(), c.ID, sigc)
92+
go ForwardAllSignals(bgCtx, dockerCli.Client(), c.Container.ID, sigc)
9393
defer signal.StopCatch(sigc)
9494
}
9595

@@ -100,7 +100,7 @@ func RunStart(ctx context.Context, dockerCli command.Cli, opts *StartOptions) er
100100

101101
options := client.ContainerAttachOptions{
102102
Stream: true,
103-
Stdin: opts.OpenStdin && c.Config.OpenStdin,
103+
Stdin: opts.OpenStdin && c.Container.Config.OpenStdin,
104104
Stdout: true,
105105
Stderr: true,
106106
DetachKeys: detachKeys,
@@ -112,7 +112,7 @@ func RunStart(ctx context.Context, dockerCli command.Cli, opts *StartOptions) er
112112
in = dockerCli.In()
113113
}
114114

115-
resp, errAttach := dockerCli.Client().ContainerAttach(ctx, c.ID, options)
115+
resp, errAttach := dockerCli.Client().ContainerAttach(ctx, c.Container.ID, options)
116116
if errAttach != nil {
117117
return errAttach
118118
}
@@ -128,7 +128,7 @@ func RunStart(ctx context.Context, dockerCli command.Cli, opts *StartOptions) er
128128
outputStream: dockerCli.Out(),
129129
errorStream: dockerCli.Err(),
130130
resp: resp.HijackedResponse,
131-
tty: c.Config.Tty,
131+
tty: c.Container.Config.Tty,
132132
detachKeys: options.DetachKeys,
133133
}
134134

@@ -142,26 +142,26 @@ func RunStart(ctx context.Context, dockerCli command.Cli, opts *StartOptions) er
142142

143143
// 3. We should open a channel for receiving status code of the container
144144
// no matter it's detached, removed on daemon side(--rm) or exit normally.
145-
statusChan := waitExitOrRemoved(ctx, dockerCli.Client(), c.ID, c.HostConfig.AutoRemove)
145+
statusChan := waitExitOrRemoved(ctx, dockerCli.Client(), c.Container.ID, c.Container.HostConfig.AutoRemove)
146146

147147
// 4. Start the container.
148-
err = dockerCli.Client().ContainerStart(ctx, c.ID, client.ContainerStartOptions{
148+
err = dockerCli.Client().ContainerStart(ctx, c.Container.ID, client.ContainerStartOptions{
149149
CheckpointID: opts.Checkpoint,
150150
CheckpointDir: opts.CheckpointDir,
151151
})
152152
if err != nil {
153153
cancelFun()
154154
<-cErr
155-
if c.HostConfig.AutoRemove {
155+
if c.Container.HostConfig.AutoRemove {
156156
// wait container to be removed
157157
<-statusChan
158158
}
159159
return err
160160
}
161161

162162
// 5. Wait for attachment to break.
163-
if c.Config.Tty && dockerCli.Out().IsTerminal() {
164-
if err := MonitorTtySize(ctx, dockerCli, c.ID, false); err != nil {
163+
if c.Container.Config.Tty && dockerCli.Out().IsTerminal() {
164+
if err := MonitorTtySize(ctx, dockerCli, c.Container.ID, false); err != nil {
165165
_, _ = fmt.Fprintln(dockerCli.Err(), "Error monitoring TTY size:", err)
166166
}
167167
}

cli/command/system/inspect.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,11 @@ func runInspect(ctx context.Context, dockerCli command.Cli, opts inspectOptions)
9999

100100
func inspectContainers(ctx context.Context, dockerCli command.Cli, getSize bool) inspect.GetRefFunc {
101101
return func(ref string) (any, []byte, error) {
102-
return dockerCli.Client().ContainerInspectWithRaw(ctx, ref, getSize)
102+
res, err := dockerCli.Client().ContainerInspect(ctx, ref, client.ContainerInspectOptions{Size: getSize})
103+
if err != nil {
104+
return nil, nil, err
105+
}
106+
return res.Container, res.Raw, err
103107
}
104108
}
105109

vendor.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ require (
2828
github.com/google/uuid v1.6.0
2929
github.com/mattn/go-runewidth v0.0.17
3030
github.com/moby/go-archive v0.1.0
31-
github.com/moby/moby/api v1.52.0-beta.2.0.20251024193508-be8d6e2f2825 // master
32-
github.com/moby/moby/client v0.1.0-beta.2.0.20251024193508-be8d6e2f2825 // master
31+
github.com/moby/moby/api v1.52.0-beta.2.0.20251026152250-0a134ecc1623 // master
32+
github.com/moby/moby/client v0.1.0-beta.2.0.20251026152250-0a134ecc1623 // master
3333
github.com/moby/patternmatcher v0.6.0
3434
github.com/moby/swarmkit/v2 v2.1.0
3535
github.com/moby/sys/atomicwriter v0.1.0

vendor.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,10 @@ github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3N
170170
github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo=
171171
github.com/moby/go-archive v0.1.0 h1:Kk/5rdW/g+H8NHdJW2gsXyZ7UnzvJNOy6VKJqueWdcQ=
172172
github.com/moby/go-archive v0.1.0/go.mod h1:G9B+YoujNohJmrIYFBpSd54GTUB4lt9S+xVQvsJyFuo=
173-
github.com/moby/moby/api v1.52.0-beta.2.0.20251024193508-be8d6e2f2825 h1:hIQtHzNpFguJCWlgZ4z9L83YjLYpf9uP9+3cSYXP9hg=
174-
github.com/moby/moby/api v1.52.0-beta.2.0.20251024193508-be8d6e2f2825/go.mod h1:/ou52HkRydg4+odrUR3vFsGgjIyHvprrpEQEkweL10s=
175-
github.com/moby/moby/client v0.1.0-beta.2.0.20251024193508-be8d6e2f2825 h1:7kbhU8foMePfI9vB24bSld1RzJQpbquW8sZarquRHbY=
176-
github.com/moby/moby/client v0.1.0-beta.2.0.20251024193508-be8d6e2f2825/go.mod h1:sxVfwGqVgh7n+tdxA4gFToQ/lf+bM7zATnvQjVnsKT4=
173+
github.com/moby/moby/api v1.52.0-beta.2.0.20251026152250-0a134ecc1623 h1:9Ulm1meUBVvvSDB65RmF7VymYBGmZ0peXCVWh6fzdoM=
174+
github.com/moby/moby/api v1.52.0-beta.2.0.20251026152250-0a134ecc1623/go.mod h1:/ou52HkRydg4+odrUR3vFsGgjIyHvprrpEQEkweL10s=
175+
github.com/moby/moby/client v0.1.0-beta.2.0.20251026152250-0a134ecc1623 h1:PkaM+LLZasetNAPJX0whFXr1GXjNQWMlyMEeUAeNUnE=
176+
github.com/moby/moby/client v0.1.0-beta.2.0.20251026152250-0a134ecc1623/go.mod h1:sxVfwGqVgh7n+tdxA4gFToQ/lf+bM7zATnvQjVnsKT4=
177177
github.com/moby/patternmatcher v0.6.0 h1:GmP9lR19aU5GqSSFko+5pRqHi+Ohk1O69aFiKkVGiPk=
178178
github.com/moby/patternmatcher v0.6.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc=
179179
github.com/moby/swarmkit/v2 v2.1.0 h1:u+cJ5hSyF3HnzsyI+NtegYxdIPQIuibk7IbpXNxuISM=

vendor/github.com/moby/moby/client/client_interfaces.go

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)