Skip to content

Commit 56e555b

Browse files
committed
api/compat: switch to moby/moby
Replace github.com/docker/docker API imports with github.com/moby/moby across compat handlers, swagger models, and tests to align with upstream type definitions. Fixes: #27536. Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
1 parent 5685ac5 commit 56e555b

File tree

216 files changed

+1735
-11498
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

+1735
-11498
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: 96 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,15 @@ func WaitContainer(w http.ResponseWriter, r *http.Request) {
283283
utils.WaitContainerDocker(w, r)
284284
}
285285

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

@@ -348,7 +357,7 @@ func LibpodToContainer(l *libpod.Container, sz bool) (*handlers.Container, error
348357
return nil, err
349358
}
350359

351-
ports := []container.Port{}
360+
ports := []container.PortSummary{}
352361
for portKey, bindings := range inspect.NetworkSettings.Ports {
353362
portNum, proto, ok := strings.Cut(portKey, "/")
354363
if !ok {
@@ -362,7 +371,7 @@ func LibpodToContainer(l *libpod.Container, sz bool) (*handlers.Container, error
362371

363372
if len(bindings) == 0 {
364373
// Exposed but not published
365-
ports = append(ports, container.Port{
374+
ports = append(ports, container.PortSummary{
366375
PrivatePort: uint16(containerPort),
367376
Type: proto,
368377
})
@@ -372,9 +381,16 @@ func LibpodToContainer(l *libpod.Container, sz bool) (*handlers.Container, error
372381
if err != nil {
373382
return nil, fmt.Errorf("invalid HostPort: %v", err)
374383
}
384+
addr := netip.Addr{}
385+
if b.HostIP != "" {
386+
addr, err = netip.ParseAddr(b.HostIP)
387+
if err != nil {
388+
return nil, fmt.Errorf("invalid HostIP: %v", err)
389+
}
390+
}
375391

376-
ports = append(ports, container.Port{
377-
IP: b.HostIP,
392+
ports = append(ports, container.PortSummary{
393+
IP: addr,
378394
PrivatePort: uint16(containerPort),
379395
PublicPort: uint16(hostPortInt),
380396
Type: proto,
@@ -402,7 +418,7 @@ func LibpodToContainer(l *libpod.Container, sz bool) (*handlers.Container, error
402418
}
403419

404420
return &handlers.Container{
405-
Container: container.Summary{
421+
Summary: container.Summary{
406422
ID: l.ID(),
407423
Names: []string{fmt.Sprintf("/%s", l.Name())},
408424
Image: imageName,
@@ -413,7 +429,7 @@ func LibpodToContainer(l *libpod.Container, sz bool) (*handlers.Container, error
413429
SizeRw: sizeRW,
414430
SizeRootFs: sizeRootFs,
415431
Labels: l.Labels(),
416-
State: stateStr,
432+
State: container.ContainerState(stateStr),
417433
Status: status,
418434
// FIXME: this seems broken, the field is never shown in the API output.
419435
HostConfig: struct {
@@ -426,20 +442,11 @@ func LibpodToContainer(l *libpod.Container, sz bool) (*handlers.Container, error
426442
NetworkSettings: &networkSettings,
427443
Mounts: mounts,
428444
},
429-
ContainerCreateConfig: dockerBackend.ContainerCreateConfig{},
445+
ContainerCreateConfig: handlers.ContainerCreateConfig{},
430446
}, nil
431447
}
432448

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) {
449+
func LibpodToContainerJSON(l *libpod.Container, sz bool) (*handlers.LegacyImageInspect, error) {
443450
imageID, imageName := l.Image()
444451
inspect, err := l.Inspect(sz)
445452
if err != nil {
@@ -465,7 +472,7 @@ func LibpodToContainerJSON(l *libpod.Container, sz bool) (*container.InspectResp
465472
}
466473

467474
// map our statuses to Docker's statuses
468-
switch state.Status {
475+
switch string(state.Status) {
469476
case define.ContainerStateConfigured.String(), define.ContainerStateCreated.String():
470477
state.Status = "created"
471478
case define.ContainerStateRunning.String(), define.ContainerStateStopping.String():
@@ -483,7 +490,7 @@ func LibpodToContainerJSON(l *libpod.Container, sz bool) (*container.InspectResp
483490
if l.HasHealthCheck() && state.Status != "created" {
484491
state.Health = &container.Health{}
485492
if inspect.State.Health != nil {
486-
state.Health.Status = inspect.State.Health.Status
493+
state.Health.Status = container.HealthStatus(inspect.State.Health.Status)
487494
state.Health.FailingStreak = inspect.State.Health.FailingStreak
488495
log := inspect.State.Health.Log
489496

@@ -537,29 +544,31 @@ func LibpodToContainerJSON(l *libpod.Container, sz bool) (*container.InspectResp
537544
Data: inspect.GraphDriver.Data,
538545
}
539546

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,
547+
cb := handlers.LegacyImageInspect{
548+
InspectResponse: container.InspectResponse{
549+
ID: l.ID(),
550+
Created: l.CreatedTime().UTC().Format(time.RFC3339Nano), // Docker uses UTC
551+
Path: inspect.Path,
552+
Args: inspect.Args,
553+
State: &state,
554+
Image: "sha256:" + imageID,
555+
ResolvConfPath: inspect.ResolvConfPath,
556+
HostnamePath: inspect.HostnamePath,
557+
HostsPath: inspect.HostsPath,
558+
LogPath: l.LogPath(),
559+
Name: fmt.Sprintf("/%s", l.Name()),
560+
RestartCount: int(inspect.RestartCount),
561+
Driver: inspect.Driver,
562+
Platform: "linux",
563+
MountLabel: inspect.MountLabel,
564+
ProcessLabel: inspect.ProcessLabel,
565+
AppArmorProfile: inspect.AppArmorProfile,
566+
ExecIDs: inspect.ExecIDs,
567+
HostConfig: &hc,
568+
GraphDriver: &graphDriver,
569+
SizeRw: inspect.SizeRw,
570+
SizeRootFs: &inspect.SizeRootFs,
571+
},
563572
}
564573

565574
// set Path and Args
@@ -583,42 +592,47 @@ func LibpodToContainerJSON(l *libpod.Container, sz bool) (*container.InspectResp
583592
}
584593
}
585594

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
595+
// Convert to moby PortSet.
596+
var exposedPorts network.PortSet
589597
if len(inspect.Config.ExposedPorts) > 0 {
590-
exposedPorts = make(nat.PortSet)
598+
exposedPorts = make(network.PortSet, len(inspect.Config.ExposedPorts))
591599
for p := range inspect.Config.ExposedPorts {
592-
exposedPorts[nat.Port(p)] = struct{}{}
600+
mp, err := network.ParsePort(p)
601+
if err != nil {
602+
return nil, fmt.Errorf("invalid exposed port %q: %w", p, err)
603+
}
604+
exposedPorts[mp] = struct{}{}
593605
}
594606
}
595607

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,
608+
config := handlers.ContainerConfig{
609+
Config: container.Config{
610+
Hostname: l.Hostname(),
611+
Domainname: inspect.Config.DomainName,
612+
User: l.User(),
613+
AttachStdin: inspect.Config.AttachStdin,
614+
AttachStdout: inspect.Config.AttachStdout,
615+
AttachStderr: inspect.Config.AttachStderr,
616+
ExposedPorts: exposedPorts,
617+
Tty: inspect.Config.Tty,
618+
OpenStdin: inspect.Config.OpenStdin,
619+
StdinOnce: inspect.Config.StdinOnce,
620+
Env: inspect.Config.Env,
621+
Cmd: l.Command(),
622+
Healthcheck: healthcheck,
623+
ArgsEscaped: false,
624+
Image: imageName,
625+
Volumes: nil,
626+
WorkingDir: l.WorkingDir(),
627+
Entrypoint: l.Entrypoint(),
628+
NetworkDisabled: false,
629+
OnBuild: nil,
630+
Labels: l.Labels(),
631+
StopSignal: strconv.Itoa(int(l.StopSignal())),
632+
StopTimeout: &stopTimeout,
633+
Shell: nil,
634+
},
635+
MacAddress: "",
622636
}
623637

624638
m, err := json.Marshal(inspect.Mounts)
@@ -644,7 +658,7 @@ func LibpodToContainerJSON(l *libpod.Container, sz bool) (*container.InspectResp
644658
return nil, err
645659
}
646660

647-
networkSettings := container.NetworkSettings{}
661+
networkSettings := handlers.LegacyNetworkSettings{}
648662
if err := json.Unmarshal(n, &networkSettings); err != nil {
649663
return nil, err
650664
}
@@ -656,13 +670,10 @@ func LibpodToContainerJSON(l *libpod.Container, sz bool) (*container.InspectResp
656670
networkSettings.Networks = map[string]*network.EndpointSettings{}
657671
}
658672

659-
c := container.InspectResponse{
660-
ContainerJSONBase: &cb,
661-
Mounts: mounts,
662-
Config: &config,
663-
NetworkSettings: &networkSettings,
664-
}
665-
return &c, nil
673+
cb.Mounts = mounts
674+
cb.Config = &config
675+
cb.NetworkSettings = &networkSettings
676+
return &cb, nil
666677
}
667678

668679
func formatCapabilities(slice []string) {

0 commit comments

Comments
 (0)