Skip to content

Commit 0015eb7

Browse files
committed
Replace usage of deprecated Image*Options
Signed-off-by: Paweł Gronowski <[email protected]>
1 parent 6e8bf2c commit 0015eb7

File tree

10 files changed

+27
-27
lines changed

10 files changed

+27
-27
lines changed

docs/reference/compose_attach.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Attach local standard input, output, and error streams to a service's running co
1111
| `--dry-run` | | | Execute command in dry run mode |
1212
| `--index` | `int` | `0` | index of the container if service has multiple replicas. |
1313
| `--no-stdin` | | | Do not attach STDIN |
14-
| `--sig-proxy` | | | Proxy all received signals to the process |
14+
| `--sig-proxy` | `bool` | `true` | Proxy all received signals to the process |
1515

1616

1717
<!---MARKER_GEN_END-->

docs/reference/compose_exec.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Execute a command in a running container
1111
| `--dry-run` | | | Execute command in dry run mode |
1212
| `-e`, `--env` | `stringArray` | | Set environment variables |
1313
| `--index` | `int` | `0` | Index of the container if service has multiple replicas |
14-
| `-T`, `--no-TTY` | | | Disable pseudo-TTY allocation. By default `docker compose exec` allocates a TTY. |
14+
| `-T`, `--no-TTY` | `bool` | `true` | Disable pseudo-TTY allocation. By default `docker compose exec` allocates a TTY. |
1515
| `--privileged` | | | Give extended privileges to the process |
1616
| `-u`, `--user` | `string` | | Run the command as this user |
1717
| `-w`, `--workdir` | `string` | | Path to workdir directory for this command |

docs/reference/compose_ps.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ List containers
1212
| [`--filter`](#filter) | `string` | | Filter services by a property (supported filters: status) |
1313
| [`--format`](#format) | `string` | `table` | Format output using a custom template:<br>'table': Print output in table format with column headers (default)<br>'table TEMPLATE': Print output in table format using the given Go template<br>'json': Print in JSON format<br>'TEMPLATE': Print output using the given Go template.<br>Refer to https://docs.docker.com/go/formatting/ for more information about formatting output with templates |
1414
| `--no-trunc` | | | Don't truncate output |
15-
| `--orphans` | | | Include orphaned services (not declared by project) |
15+
| `--orphans` | `bool` | `true` | Include orphaned services (not declared by project) |
1616
| `-q`, `--quiet` | | | Only display IDs |
1717
| `--services` | | | Display services |
1818
| [`--status`](#status) | `stringArray` | | Filter services by status. Values: [paused \| restarting \| removing \| running \| dead \| created \| exited] |

docs/reference/compose_run.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ Run a one-off command on a service
1414
| `--dry-run` | | | Execute command in dry run mode |
1515
| `--entrypoint` | `string` | | Override the entrypoint of the image |
1616
| `-e`, `--env` | `stringArray` | | Set environment variables |
17-
| `-i`, `--interactive` | | | Keep STDIN open even if not attached |
17+
| `-i`, `--interactive` | `bool` | `true` | Keep STDIN open even if not attached |
1818
| `-l`, `--label` | `stringArray` | | Add or override a label |
1919
| `--name` | `string` | | Assign a name to the container |
20-
| `-T`, `--no-TTY` | | | Disable pseudo-TTY allocation (default: auto-detected) |
20+
| `-T`, `--no-TTY` | `bool` | `true` | Disable pseudo-TTY allocation (default: auto-detected) |
2121
| `--no-deps` | | | Don't start linked services |
2222
| `-p`, `--publish` | `stringArray` | | Publish a container's port(s) to the host |
2323
| `--quiet-pull` | | | Pull without printing progress information |

pkg/api/dryrunclient.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import (
3838
containerType "github.com/docker/docker/api/types/container"
3939
"github.com/docker/docker/api/types/events"
4040
"github.com/docker/docker/api/types/filters"
41-
"github.com/docker/docker/api/types/image"
41+
imageType "github.com/docker/docker/api/types/image"
4242
"github.com/docker/docker/api/types/network"
4343
"github.com/docker/docker/api/types/registry"
4444
"github.com/docker/docker/api/types/swarm"
@@ -231,15 +231,15 @@ func (d *DryRunClient) ImageInspectWithRaw(ctx context.Context, imageName string
231231

232232
}
233233

234-
func (d *DryRunClient) ImagePull(ctx context.Context, ref string, options moby.ImagePullOptions) (io.ReadCloser, error) {
234+
func (d *DryRunClient) ImagePull(ctx context.Context, ref string, options imageType.PullOptions) (io.ReadCloser, error) {
235235
if _, _, err := d.resolver.Resolve(ctx, ref); err != nil {
236236
return nil, err
237237
}
238238
rc := io.NopCloser(strings.NewReader(""))
239239
return rc, nil
240240
}
241241

242-
func (d *DryRunClient) ImagePush(ctx context.Context, ref string, options moby.ImagePushOptions) (io.ReadCloser, error) {
242+
func (d *DryRunClient) ImagePush(ctx context.Context, ref string, options imageType.PushOptions) (io.ReadCloser, error) {
243243
if _, _, err := d.resolver.Resolve(ctx, ref); err != nil {
244244
return nil, err
245245
}
@@ -261,7 +261,7 @@ func (d *DryRunClient) ImagePush(ctx context.Context, ref string, options moby.I
261261
return rc, nil
262262
}
263263

264-
func (d *DryRunClient) ImageRemove(ctx context.Context, imageName string, options moby.ImageRemoveOptions) ([]image.DeleteResponse, error) {
264+
func (d *DryRunClient) ImageRemove(ctx context.Context, imageName string, options imageType.RemoveOptions) ([]imageType.DeleteResponse, error) {
265265
return nil, nil
266266
}
267267

@@ -419,19 +419,19 @@ func (d *DryRunClient) BuildCancel(ctx context.Context, id string) error {
419419
return d.apiClient.BuildCancel(ctx, id)
420420
}
421421

422-
func (d *DryRunClient) ImageCreate(ctx context.Context, parentReference string, options moby.ImageCreateOptions) (io.ReadCloser, error) {
422+
func (d *DryRunClient) ImageCreate(ctx context.Context, parentReference string, options imageType.CreateOptions) (io.ReadCloser, error) {
423423
return d.apiClient.ImageCreate(ctx, parentReference, options)
424424
}
425425

426-
func (d *DryRunClient) ImageHistory(ctx context.Context, imageName string) ([]image.HistoryResponseItem, error) {
426+
func (d *DryRunClient) ImageHistory(ctx context.Context, imageName string) ([]imageType.HistoryResponseItem, error) {
427427
return d.apiClient.ImageHistory(ctx, imageName)
428428
}
429429

430-
func (d *DryRunClient) ImageImport(ctx context.Context, source moby.ImageImportSource, ref string, options moby.ImageImportOptions) (io.ReadCloser, error) {
430+
func (d *DryRunClient) ImageImport(ctx context.Context, source moby.ImageImportSource, ref string, options imageType.ImportOptions) (io.ReadCloser, error) {
431431
return d.apiClient.ImageImport(ctx, source, ref, options)
432432
}
433433

434-
func (d *DryRunClient) ImageList(ctx context.Context, options moby.ImageListOptions) ([]image.Summary, error) {
434+
func (d *DryRunClient) ImageList(ctx context.Context, options imageType.ListOptions) ([]imageType.Summary, error) {
435435
return d.apiClient.ImageList(ctx, options)
436436
}
437437

pkg/compose/down.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828
moby "github.com/docker/docker/api/types"
2929
containerType "github.com/docker/docker/api/types/container"
3030
"github.com/docker/docker/api/types/filters"
31+
imageType "github.com/docker/docker/api/types/image"
3132
"github.com/docker/docker/errdefs"
3233
"golang.org/x/sync/errgroup"
3334

@@ -244,7 +245,7 @@ func (s *composeService) removeNetwork(ctx context.Context, composeNetworkName s
244245
func (s *composeService) removeImage(ctx context.Context, image string, w progress.Writer) error {
245246
id := fmt.Sprintf("Image %s", image)
246247
w.Event(progress.NewEvent(id, progress.Working, "Removing"))
247-
_, err := s.apiClient().ImageRemove(ctx, image, moby.ImageRemoveOptions{})
248+
_, err := s.apiClient().ImageRemove(ctx, image, imageType.RemoveOptions{})
248249
if err == nil {
249250
w.Event(progress.NewEvent(id, progress.Done, "Removed"))
250251
return nil

pkg/compose/down_test.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
moby "github.com/docker/docker/api/types"
2929
containerType "github.com/docker/docker/api/types/container"
3030
"github.com/docker/docker/api/types/filters"
31-
"github.com/docker/docker/api/types/image"
31+
imageType "github.com/docker/docker/api/types/image"
3232
"github.com/docker/docker/api/types/volume"
3333
"github.com/docker/docker/errdefs"
3434
"go.uber.org/mock/gomock"
@@ -205,12 +205,12 @@ func TestDownRemoveImages(t *testing.T) {
205205
}, nil).
206206
AnyTimes()
207207

208-
api.EXPECT().ImageList(gomock.Any(), moby.ImageListOptions{
208+
api.EXPECT().ImageList(gomock.Any(), imageType.ListOptions{
209209
Filters: filters.NewArgs(
210210
projectFilter(strings.ToLower(testProject)),
211211
filters.Arg("dangling", "false"),
212212
),
213-
}).Return([]image.Summary{
213+
}).Return([]imageType.Summary{
214214
{
215215
Labels: types.Labels{compose.ServiceLabel: "local-anonymous"},
216216
RepoTags: []string{"testproject-local-anonymous:latest"},
@@ -253,7 +253,7 @@ func TestDownRemoveImages(t *testing.T) {
253253
for _, img := range localImagesToBeRemoved {
254254
// test calls down --rmi=local then down --rmi=all, so local images
255255
// get "removed" 2x, while other images are only 1x
256-
api.EXPECT().ImageRemove(gomock.Any(), img, moby.ImageRemoveOptions{}).
256+
api.EXPECT().ImageRemove(gomock.Any(), img, imageType.RemoveOptions{}).
257257
Return(nil, nil).
258258
Times(2)
259259
}
@@ -268,7 +268,7 @@ func TestDownRemoveImages(t *testing.T) {
268268
"registry.example.com/remote-image-tagged:v1.0",
269269
}
270270
for _, img := range otherImagesToBeRemoved {
271-
api.EXPECT().ImageRemove(gomock.Any(), img, moby.ImageRemoveOptions{}).
271+
api.EXPECT().ImageRemove(gomock.Any(), img, imageType.RemoveOptions{}).
272272
Return(nil, nil).
273273
Times(1)
274274
}
@@ -306,7 +306,7 @@ func TestDownRemoveImages_NoLabel(t *testing.T) {
306306

307307
// ImageList returns no images for the project since they were unlabeled
308308
// (created by an older version of Compose)
309-
api.EXPECT().ImageList(gomock.Any(), moby.ImageListOptions{
309+
api.EXPECT().ImageList(gomock.Any(), imageType.ListOptions{
310310
Filters: filters.NewArgs(
311311
projectFilter(strings.ToLower(testProject)),
312312
filters.Arg("dangling", "false"),
@@ -319,7 +319,7 @@ func TestDownRemoveImages_NoLabel(t *testing.T) {
319319
api.EXPECT().ContainerStop(gomock.Any(), "123", containerType.StopOptions{}).Return(nil)
320320
api.EXPECT().ContainerRemove(gomock.Any(), "123", containerType.RemoveOptions{Force: true}).Return(nil)
321321

322-
api.EXPECT().ImageRemove(gomock.Any(), "testproject-service1:latest", moby.ImageRemoveOptions{}).Return(nil, nil)
322+
api.EXPECT().ImageRemove(gomock.Any(), "testproject-service1:latest", imageType.RemoveOptions{}).Return(nil, nil)
323323

324324
err := tested.Down(context.Background(), strings.ToLower(testProject), compose.DownOptions{Images: "local"})
325325
assert.NilError(t, err)

pkg/compose/image_pruner.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import (
2424

2525
"github.com/compose-spec/compose-go/v2/types"
2626
"github.com/distribution/reference"
27-
moby "github.com/docker/docker/api/types"
2827
"github.com/docker/docker/api/types/filters"
2928
"github.com/docker/docker/api/types/image"
3029
"github.com/docker/docker/client"
@@ -151,7 +150,7 @@ func (p *ImagePruner) namedImages(ctx context.Context) ([]string, error) {
151150
// The image name could either have been defined by the user or implicitly
152151
// created from the project + service name.
153152
func (p *ImagePruner) labeledLocalImages(ctx context.Context) ([]image.Summary, error) {
154-
imageListOpts := moby.ImageListOptions{
153+
imageListOpts := image.ListOptions{
155154
Filters: filters.NewArgs(
156155
projectFilter(p.project.Name),
157156
// TODO(milas): we should really clean up the dangling images as

pkg/compose/pull.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929
"github.com/distribution/reference"
3030
"github.com/docker/buildx/driver"
3131
"github.com/docker/cli/cli/config/configfile"
32-
moby "github.com/docker/docker/api/types"
32+
imageType "github.com/docker/docker/api/types/image"
3333
"github.com/docker/docker/client"
3434
"github.com/docker/docker/pkg/jsonmessage"
3535
"github.com/docker/docker/registry"
@@ -191,7 +191,7 @@ func (s *composeService) pullServiceImage(ctx context.Context, service types.Ser
191191
platform = defaultPlatform
192192
}
193193

194-
stream, err := s.apiClient().ImagePull(ctx, service.Image, moby.ImagePullOptions{
194+
stream, err := s.apiClient().ImagePull(ctx, service.Image, imageType.PullOptions{
195195
RegistryAuth: encodedAuth,
196196
Platform: platform,
197197
})

pkg/compose/push.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
"github.com/compose-spec/compose-go/v2/types"
2929
"github.com/distribution/reference"
3030
"github.com/docker/buildx/driver"
31-
moby "github.com/docker/docker/api/types"
31+
imageType "github.com/docker/docker/api/types/image"
3232
"github.com/docker/docker/api/types/system"
3333
"github.com/docker/docker/pkg/jsonmessage"
3434
"github.com/docker/docker/registry"
@@ -117,7 +117,7 @@ func (s *composeService) pushServiceImage(ctx context.Context, tag string, info
117117
return err
118118
}
119119

120-
stream, err := s.apiClient().ImagePush(ctx, tag, moby.ImagePushOptions{
120+
stream, err := s.apiClient().ImagePush(ctx, tag, imageType.PushOptions{
121121
RegistryAuth: base64.URLEncoding.EncodeToString(buf),
122122
})
123123
if err != nil {

0 commit comments

Comments
 (0)