Skip to content

Commit 1c3cc92

Browse files
authored
Merge pull request #28057 from jankaluza/27536
api/compat: switch to moby/moby
2 parents 5685ac5 + 01688e7 commit 1c3cc92

File tree

216 files changed

+1796
-11502
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

216 files changed

+1796
-11502
lines changed

go.mod

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ require (
4242
github.com/mattn/go-sqlite3 v1.14.34
4343
github.com/mdlayher/vsock v1.2.1
4444
github.com/moby/docker-image-spec v1.3.1
45+
github.com/moby/moby/api v1.53.0
46+
github.com/moby/moby/client v0.2.2
4547
github.com/moby/sys/capability v0.4.0
4648
github.com/moby/sys/user v0.4.0
4749
github.com/moby/term v0.5.2
@@ -139,8 +141,6 @@ require (
139141
github.com/mistifyio/go-zfs/v4 v4.0.0 // indirect
140142
github.com/moby/buildkit v0.26.3 // indirect
141143
github.com/moby/go-archive v0.1.0 // indirect
142-
github.com/moby/moby/api v1.53.0 // indirect
143-
github.com/moby/moby/client v0.2.2 // indirect
144144
github.com/moby/patternmatcher v0.6.0 // indirect
145145
github.com/moby/sys/mountinfo v0.7.2 // indirect
146146
github.com/moby/sys/sequential v0.6.0 // indirect
@@ -184,7 +184,6 @@ require (
184184
golang.org/x/mod v0.32.0 // indirect
185185
golang.org/x/oauth2 v0.35.0 // indirect
186186
golang.org/x/text v0.34.0 // indirect
187-
golang.org/x/time v0.14.0 // indirect
188187
golang.org/x/tools v0.41.0 // indirect
189188
google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 // indirect
190189
google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 // indirect

go.sum

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ github.com/aead/serpent v0.0.0-20160714141033-fba169763ea6 h1:5L8Mj9Co9sJVgW3TpY
2222
github.com/aead/serpent v0.0.0-20160714141033-fba169763ea6/go.mod h1:3HgLJ9d18kXMLQlJvIY3+FszZYMxCz8WfE2MQ7hDY0w=
2323
github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM=
2424
github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ=
25-
github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM=
26-
github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw=
2725
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
2826
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
2927
github.com/checkpoint-restore/checkpointctl v1.5.0 h1:Uu+D2cOf/GUyCMk23Y8L69P6YoATTe6pH+Au64O3y28=
@@ -180,8 +178,6 @@ github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
180178
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
181179
github.com/gorilla/schema v1.4.1 h1:jUg5hUjCSDZpNGLuXQOgIWGdlgrIdYvgQ0wZtdK1M3E=
182180
github.com/gorilla/schema v1.4.1/go.mod h1:Dg5SSm5PV60mhF2NFaTV1xuYYj8tV8NOPRo4FggUMnM=
183-
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.3 h1:NmZ1PKzSTQbuGHw9DGPFomqkkLWMC+vZCkfs+FHv1Vg=
184-
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.3/go.mod h1:zQrxl1YP88HQlA6i9c63DSVPFklWpGX4OWAc9bFuaH4=
185181
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
186182
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
187183
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
@@ -267,8 +263,6 @@ github.com/moby/moby/client v0.2.2 h1:Pt4hRMCAIlyjL3cr8M5TrXCwKzguebPAc2do2ur7dE
267263
github.com/moby/moby/client v0.2.2/go.mod h1:2EkIPVNCqR05CMIzL1mfA07t0HvVUUOl85pasRz/GmQ=
268264
github.com/moby/patternmatcher v0.6.0 h1:GmP9lR19aU5GqSSFko+5pRqHi+Ohk1O69aFiKkVGiPk=
269265
github.com/moby/patternmatcher v0.6.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc=
270-
github.com/moby/sys/atomicwriter v0.1.0 h1:kw5D/EqkBwsBFi0ss9v1VG3wIkVhzGvLklJ+w3A14Sw=
271-
github.com/moby/sys/atomicwriter v0.1.0/go.mod h1:Ul8oqv2ZMNHOceF643P6FKPXeCmYtlQMvpizfsSoaWs=
272266
github.com/moby/sys/capability v0.4.0 h1:4D4mI6KlNtWMCM1Z/K0i7RV1FkX+DBDHKVJpCndZoHk=
273267
github.com/moby/sys/capability v0.4.0/go.mod h1:4g9IK291rVkms3LKCDOoYlnV8xKwoDTpIrNEE35Wq0I=
274268
github.com/moby/sys/mountinfo v0.7.2 h1:1shs6aH5s4o5H2zQLn796ADW1wMrIwHsyJ2v9KouLrg=
@@ -431,10 +425,6 @@ go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0 h1:RbKq8BG
431425
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0/go.mod h1:h06DGIukJOevXaj/xrNjhi/2098RZzcLTbc0jDAUbsg=
432426
go.opentelemetry.io/otel v1.39.0 h1:8yPrr/S0ND9QEfTfdP9V+SiwT4E0G7Y5MO7p85nis48=
433427
go.opentelemetry.io/otel v1.39.0/go.mod h1:kLlFTywNWrFyEdH0oj2xK0bFYZtHRYUdv1NklR/tgc8=
434-
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 h1:GqRJVj7UmLjCVyVJ3ZFLdPRmhDUp2zFmQe3RHIOsw24=
435-
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0/go.mod h1:ri3aaHSmCTVYu2AWv44YMauwAQc0aqI9gHKIcSbI1pU=
436-
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0 h1:aTL7F04bJHUlztTsNGJ2l+6he8c+y/b//eR0jjjemT4=
437-
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0/go.mod h1:kldtb7jDTeol0l3ewcmd8SDvx3EmIE7lyvqbasU3QC4=
438428
go.opentelemetry.io/otel/metric v1.39.0 h1:d1UzonvEZriVfpNKEVmHXbdf909uGTOQjA0HF0Ls5Q0=
439429
go.opentelemetry.io/otel/metric v1.39.0/go.mod h1:jrZSWL33sD7bBxg1xjrqyDjnuzTUB0x1nBERXd7Ftcs=
440430
go.opentelemetry.io/otel/sdk v1.39.0 h1:nMLYcjVsvdui1B/4FRkwjzoRVsMK8uL/cj0OyhKzt18=
@@ -443,8 +433,6 @@ go.opentelemetry.io/otel/sdk/metric v1.39.0 h1:cXMVVFVgsIf2YL6QkRF4Urbr/aMInf+2W
443433
go.opentelemetry.io/otel/sdk/metric v1.39.0/go.mod h1:xq9HEVH7qeX69/JnwEfp6fVq5wosJsY1mt4lLfYdVew=
444434
go.opentelemetry.io/otel/trace v1.39.0 h1:2d2vfpEDmCJ5zVYz7ijaJdOF59xLomrvj7bjt6/qCJI=
445435
go.opentelemetry.io/otel/trace v1.39.0/go.mod h1:88w4/PnZSazkGzz/w84VHpQafiU4EtqqlVdxWy+rNOA=
446-
go.opentelemetry.io/proto/otlp v1.7.1 h1:gTOMpGDb0WTBOP8JaO72iL3auEZhVmAQg4ipjOVAtj4=
447-
go.opentelemetry.io/proto/otlp v1.7.1/go.mod h1:b2rVh6rfI/s2pHWNlB7ILJcRALpcNDzKhACevjI+ZnE=
448436
go.podman.io/common v0.67.1-0.20260304132626-c0ec6c1ad7ea h1:iDxH5QwfIOjhuhLKsCDmakIzK+nbJ7iWv4+nvOBVzYs=
449437
go.podman.io/common v0.67.1-0.20260304132626-c0ec6c1ad7ea/go.mod h1:ej/rUzFJ27a3nxsDtZdQnp1+2EzuAA8dgv2Cl9BcBjg=
450438
go.podman.io/image/v5 v5.39.2-0.20260304132626-c0ec6c1ad7ea h1:r1F0pu+uRPx3G5Z7Bzf6pBxJgypQTOaMDkMQelZdBDM=
@@ -553,8 +541,6 @@ golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
553541
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
554542
golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk=
555543
golang.org/x/text v0.34.0/go.mod h1:homfLqTYRFyVYemLBFl5GgL/DWEiH5wcsQ5gSh1yziA=
556-
golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI=
557-
golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4=
558544
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
559545
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
560546
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=

pkg/api/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ serve: ${SWAGGER_OUT}
1212
${SWAGGER_OUT}:
1313
# generate doesn't remove file on error
1414
rm -f ${SWAGGER_OUT}
15-
$(SWAGGER) generate spec -x github.com/sigstore/rekor -x github.com/docker/docker/api/types/network -x github.com/moby/moby/api -o ${SWAGGER_OUT} -i tags.yaml -w ./ -m
15+
$(SWAGGER) generate spec -c github.com/containers/podman -x github.com/sigstore/rekor -x github.com/moby/moby/api/types/network -x github.com/docker/docker/api/types/network -x github.com/moby/moby/api -o ${SWAGGER_OUT} -i tags.yaml -w ./ -m

pkg/api/handlers/compat/auth.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"github.com/containers/podman/v6/pkg/api/handlers/utils"
1515
api "github.com/containers/podman/v6/pkg/api/types"
1616
"github.com/containers/podman/v6/pkg/domain/entities"
17-
"github.com/docker/docker/api/types/registry"
17+
"github.com/moby/moby/api/types/registry"
1818
"go.podman.io/common/pkg/auth"
1919
DockerClient "go.podman.io/image/v5/docker"
2020
"go.podman.io/image/v5/types"

pkg/api/handlers/compat/containers.go

Lines changed: 98 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"errors"
88
"fmt"
99
"net/http"
10+
"net/netip"
1011
"sort"
1112
"strconv"
1213
"strings"
@@ -25,12 +26,11 @@ import (
2526
"github.com/containers/podman/v6/pkg/signal"
2627
"github.com/containers/podman/v6/pkg/specgenutil"
2728
"github.com/containers/podman/v6/pkg/util"
28-
dockerBackend "github.com/docker/docker/api/types/backend"
29-
"github.com/docker/docker/api/types/container"
30-
"github.com/docker/docker/api/types/network"
31-
"github.com/docker/docker/api/types/storage"
3229
"github.com/docker/go-connections/nat"
3330
"github.com/docker/go-units"
31+
"github.com/moby/moby/api/types/container"
32+
"github.com/moby/moby/api/types/network"
33+
"github.com/moby/moby/api/types/storage"
3434
spec "github.com/opencontainers/runtime-spec/specs-go"
3535
"github.com/sirupsen/logrus"
3636
)
@@ -283,6 +283,16 @@ func WaitContainer(w http.ResponseWriter, r *http.Request) {
283283
utils.WaitContainerDocker(w, r)
284284
}
285285

286+
//nolint:staticcheck
287+
func convertSecondaryIPPrefixLen(input *define.InspectNetworkSettings, output *handlers.LegacyNetworkSettings) {
288+
for index, ip := range input.SecondaryIPAddresses {
289+
output.SecondaryIPAddresses[index].PrefixLen = ip.PrefixLength
290+
}
291+
for index, ip := range input.SecondaryIPv6Addresses {
292+
output.SecondaryIPv6Addresses[index].PrefixLen = ip.PrefixLength
293+
}
294+
}
295+
286296
func LibpodToContainer(l *libpod.Container, sz bool) (*handlers.Container, error) {
287297
imageID, imageName := l.Image()
288298

@@ -348,7 +358,7 @@ func LibpodToContainer(l *libpod.Container, sz bool) (*handlers.Container, error
348358
return nil, err
349359
}
350360

351-
ports := []container.Port{}
361+
ports := []container.PortSummary{}
352362
for portKey, bindings := range inspect.NetworkSettings.Ports {
353363
portNum, proto, ok := strings.Cut(portKey, "/")
354364
if !ok {
@@ -362,7 +372,7 @@ func LibpodToContainer(l *libpod.Container, sz bool) (*handlers.Container, error
362372

363373
if len(bindings) == 0 {
364374
// Exposed but not published
365-
ports = append(ports, container.Port{
375+
ports = append(ports, container.PortSummary{
366376
PrivatePort: uint16(containerPort),
367377
Type: proto,
368378
})
@@ -372,9 +382,16 @@ func LibpodToContainer(l *libpod.Container, sz bool) (*handlers.Container, error
372382
if err != nil {
373383
return nil, fmt.Errorf("invalid HostPort: %v", err)
374384
}
385+
addr := netip.Addr{}
386+
if b.HostIP != "" {
387+
addr, err = netip.ParseAddr(b.HostIP)
388+
if err != nil {
389+
return nil, fmt.Errorf("invalid HostIP: %v", err)
390+
}
391+
}
375392

376-
ports = append(ports, container.Port{
377-
IP: b.HostIP,
393+
ports = append(ports, container.PortSummary{
394+
IP: addr,
378395
PrivatePort: uint16(containerPort),
379396
PublicPort: uint16(hostPortInt),
380397
Type: proto,
@@ -402,7 +419,7 @@ func LibpodToContainer(l *libpod.Container, sz bool) (*handlers.Container, error
402419
}
403420

404421
return &handlers.Container{
405-
Container: container.Summary{
422+
Summary: container.Summary{
406423
ID: l.ID(),
407424
Names: []string{fmt.Sprintf("/%s", l.Name())},
408425
Image: imageName,
@@ -413,7 +430,7 @@ func LibpodToContainer(l *libpod.Container, sz bool) (*handlers.Container, error
413430
SizeRw: sizeRW,
414431
SizeRootFs: sizeRootFs,
415432
Labels: l.Labels(),
416-
State: stateStr,
433+
State: container.ContainerState(stateStr),
417434
Status: status,
418435
// FIXME: this seems broken, the field is never shown in the API output.
419436
HostConfig: struct {
@@ -426,20 +443,12 @@ func LibpodToContainer(l *libpod.Container, sz bool) (*handlers.Container, error
426443
NetworkSettings: &networkSettings,
427444
Mounts: mounts,
428445
},
429-
ContainerCreateConfig: dockerBackend.ContainerCreateConfig{},
446+
ContainerCreateConfig: handlers.ContainerCreateConfig{},
430447
}, nil
431448
}
432449

433-
func convertSecondaryIPPrefixLen(input *define.InspectNetworkSettings, output *container.NetworkSettings) {
434-
for index, ip := range input.SecondaryIPAddresses {
435-
output.SecondaryIPAddresses[index].PrefixLen = ip.PrefixLength
436-
}
437-
for index, ip := range input.SecondaryIPv6Addresses {
438-
output.SecondaryIPv6Addresses[index].PrefixLen = ip.PrefixLength
439-
}
440-
}
441-
442-
func LibpodToContainerJSON(l *libpod.Container, sz bool) (*container.InspectResponse, error) {
450+
//nolint:staticcheck
451+
func LibpodToContainerJSON(l *libpod.Container, sz bool) (*handlers.LegacyImageInspect, error) {
443452
imageID, imageName := l.Image()
444453
inspect, err := l.Inspect(sz)
445454
if err != nil {
@@ -465,7 +474,7 @@ func LibpodToContainerJSON(l *libpod.Container, sz bool) (*container.InspectResp
465474
}
466475

467476
// map our statuses to Docker's statuses
468-
switch state.Status {
477+
switch string(state.Status) {
469478
case define.ContainerStateConfigured.String(), define.ContainerStateCreated.String():
470479
state.Status = "created"
471480
case define.ContainerStateRunning.String(), define.ContainerStateStopping.String():
@@ -483,7 +492,7 @@ func LibpodToContainerJSON(l *libpod.Container, sz bool) (*container.InspectResp
483492
if l.HasHealthCheck() && state.Status != "created" {
484493
state.Health = &container.Health{}
485494
if inspect.State.Health != nil {
486-
state.Health.Status = inspect.State.Health.Status
495+
state.Health.Status = container.HealthStatus(inspect.State.Health.Status)
487496
state.Health.FailingStreak = inspect.State.Health.FailingStreak
488497
log := inspect.State.Health.Log
489498

@@ -537,29 +546,31 @@ func LibpodToContainerJSON(l *libpod.Container, sz bool) (*container.InspectResp
537546
Data: inspect.GraphDriver.Data,
538547
}
539548

540-
cb := container.ContainerJSONBase{
541-
ID: l.ID(),
542-
Created: l.CreatedTime().UTC().Format(time.RFC3339Nano), // Docker uses UTC
543-
Path: inspect.Path,
544-
Args: inspect.Args,
545-
State: &state,
546-
Image: "sha256:" + imageID,
547-
ResolvConfPath: inspect.ResolvConfPath,
548-
HostnamePath: inspect.HostnamePath,
549-
HostsPath: inspect.HostsPath,
550-
LogPath: l.LogPath(),
551-
Name: fmt.Sprintf("/%s", l.Name()),
552-
RestartCount: int(inspect.RestartCount),
553-
Driver: inspect.Driver,
554-
Platform: "linux",
555-
MountLabel: inspect.MountLabel,
556-
ProcessLabel: inspect.ProcessLabel,
557-
AppArmorProfile: inspect.AppArmorProfile,
558-
ExecIDs: inspect.ExecIDs,
559-
HostConfig: &hc,
560-
GraphDriver: graphDriver,
561-
SizeRw: inspect.SizeRw,
562-
SizeRootFs: &inspect.SizeRootFs,
549+
cb := handlers.LegacyImageInspect{ //nolint:staticcheck
550+
InspectResponse: container.InspectResponse{
551+
ID: l.ID(),
552+
Created: l.CreatedTime().UTC().Format(time.RFC3339Nano), // Docker uses UTC
553+
Path: inspect.Path,
554+
Args: inspect.Args,
555+
State: &state,
556+
Image: "sha256:" + imageID,
557+
ResolvConfPath: inspect.ResolvConfPath,
558+
HostnamePath: inspect.HostnamePath,
559+
HostsPath: inspect.HostsPath,
560+
LogPath: l.LogPath(),
561+
Name: fmt.Sprintf("/%s", l.Name()),
562+
RestartCount: int(inspect.RestartCount),
563+
Driver: inspect.Driver,
564+
Platform: "linux",
565+
MountLabel: inspect.MountLabel,
566+
ProcessLabel: inspect.ProcessLabel,
567+
AppArmorProfile: inspect.AppArmorProfile,
568+
ExecIDs: inspect.ExecIDs,
569+
HostConfig: &hc,
570+
GraphDriver: &graphDriver,
571+
SizeRw: inspect.SizeRw,
572+
SizeRootFs: &inspect.SizeRootFs,
573+
},
563574
}
564575

565576
// set Path and Args
@@ -583,42 +594,47 @@ func LibpodToContainerJSON(l *libpod.Container, sz bool) (*container.InspectResp
583594
}
584595
}
585596

586-
// Apparently the compiler can't convert a map[string]struct{} into a nat.PortSet
587-
// (Despite a nat.PortSet being that exact struct with some types added)
588-
var exposedPorts nat.PortSet
597+
// Convert to moby PortSet.
598+
var exposedPorts network.PortSet
589599
if len(inspect.Config.ExposedPorts) > 0 {
590-
exposedPorts = make(nat.PortSet)
600+
exposedPorts = make(network.PortSet, len(inspect.Config.ExposedPorts))
591601
for p := range inspect.Config.ExposedPorts {
592-
exposedPorts[nat.Port(p)] = struct{}{}
602+
mp, err := network.ParsePort(p)
603+
if err != nil {
604+
return nil, fmt.Errorf("invalid exposed port %q: %w", p, err)
605+
}
606+
exposedPorts[mp] = struct{}{}
593607
}
594608
}
595609

596-
config := container.Config{
597-
Hostname: l.Hostname(),
598-
Domainname: inspect.Config.DomainName,
599-
User: l.User(),
600-
AttachStdin: inspect.Config.AttachStdin,
601-
AttachStdout: inspect.Config.AttachStdout,
602-
AttachStderr: inspect.Config.AttachStderr,
603-
ExposedPorts: exposedPorts,
604-
Tty: inspect.Config.Tty,
605-
OpenStdin: inspect.Config.OpenStdin,
606-
StdinOnce: inspect.Config.StdinOnce,
607-
Env: inspect.Config.Env,
608-
Cmd: l.Command(),
609-
Healthcheck: healthcheck,
610-
ArgsEscaped: false,
611-
Image: imageName,
612-
Volumes: nil,
613-
WorkingDir: l.WorkingDir(),
614-
Entrypoint: l.Entrypoint(),
615-
NetworkDisabled: false,
616-
MacAddress: "",
617-
OnBuild: nil,
618-
Labels: l.Labels(),
619-
StopSignal: strconv.Itoa(int(l.StopSignal())),
620-
StopTimeout: &stopTimeout,
621-
Shell: nil,
610+
config := handlers.ContainerConfig{
611+
Config: container.Config{
612+
Hostname: l.Hostname(),
613+
Domainname: inspect.Config.DomainName,
614+
User: l.User(),
615+
AttachStdin: inspect.Config.AttachStdin,
616+
AttachStdout: inspect.Config.AttachStdout,
617+
AttachStderr: inspect.Config.AttachStderr,
618+
ExposedPorts: exposedPorts,
619+
Tty: inspect.Config.Tty,
620+
OpenStdin: inspect.Config.OpenStdin,
621+
StdinOnce: inspect.Config.StdinOnce,
622+
Env: inspect.Config.Env,
623+
Cmd: l.Command(),
624+
Healthcheck: healthcheck,
625+
ArgsEscaped: false,
626+
Image: imageName,
627+
Volumes: nil,
628+
WorkingDir: l.WorkingDir(),
629+
Entrypoint: l.Entrypoint(),
630+
NetworkDisabled: false,
631+
OnBuild: nil,
632+
Labels: l.Labels(),
633+
StopSignal: strconv.Itoa(int(l.StopSignal())),
634+
StopTimeout: &stopTimeout,
635+
Shell: nil,
636+
},
637+
MacAddress: "",
622638
}
623639

624640
m, err := json.Marshal(inspect.Mounts)
@@ -644,7 +660,7 @@ func LibpodToContainerJSON(l *libpod.Container, sz bool) (*container.InspectResp
644660
return nil, err
645661
}
646662

647-
networkSettings := container.NetworkSettings{}
663+
networkSettings := handlers.LegacyNetworkSettings{} //nolint:staticcheck
648664
if err := json.Unmarshal(n, &networkSettings); err != nil {
649665
return nil, err
650666
}
@@ -656,13 +672,10 @@ func LibpodToContainerJSON(l *libpod.Container, sz bool) (*container.InspectResp
656672
networkSettings.Networks = map[string]*network.EndpointSettings{}
657673
}
658674

659-
c := container.InspectResponse{
660-
ContainerJSONBase: &cb,
661-
Mounts: mounts,
662-
Config: &config,
663-
NetworkSettings: &networkSettings,
664-
}
665-
return &c, nil
675+
cb.Mounts = mounts
676+
cb.Config = &config
677+
cb.NetworkSettings = &networkSettings
678+
return &cb, nil
666679
}
667680

668681
func formatCapabilities(slice []string) {

0 commit comments

Comments
 (0)