summaryrefslogtreecommitdiff
path: root/pkg/api
diff options
context:
space:
mode:
authorBrent Baude <bbaude@redhat.com>2021-07-09 10:07:39 -0500
committerBrent Baude <bbaude@redhat.com>2021-07-09 10:10:04 -0500
commitdaebdf3859ad3c912b068ea6b48e49f23c9ed0c2 (patch)
treed0babe6ec89af6006f4645d1f9e9c61bca97689f /pkg/api
parent43abe006a3d8026b6cc7deace0a29a08a5d4bc08 (diff)
downloadpodman-daebdf3859ad3c912b068ea6b48e49f23c9ed0c2.tar.gz
podman-daebdf3859ad3c912b068ea6b48e49f23c9ed0c2.tar.bz2
podman-daebdf3859ad3c912b068ea6b48e49f23c9ed0c2.zip
Add container config to compat image inspect
With docker-compose, there is a use case where you can `docker-compose up -d`, then change a file like docker-compose.yml and run up again. This requires a ContainerConfig with at least Volumes be populated in the inspect data. This PR adds just that. Fixes: #10795 Signed-off-by: Brent Baude <bbaude@redhat.com>
Diffstat (limited to 'pkg/api')
-rw-r--r--pkg/api/handlers/types.go43
1 files changed, 24 insertions, 19 deletions
diff --git a/pkg/api/handlers/types.go b/pkg/api/handlers/types.go
index ee157cb56..59f948567 100644
--- a/pkg/api/handlers/types.go
+++ b/pkg/api/handlers/types.go
@@ -232,27 +232,32 @@ func ImageDataToImageInspect(ctx context.Context, l *libimage.Image) (*ImageInsp
Name: info.GraphDriver.Name,
Data: info.GraphDriver.Data,
}
+ // Add in basic ContainerConfig to satisfy docker-compose
+ cc := new(dockerContainer.Config)
+ cc.Hostname = info.ID[0:11] // short ID is the hostname
+ cc.Volumes = info.Config.Volumes
+
dockerImageInspect := docker.ImageInspect{
- Architecture: info.Architecture,
- Author: info.Author,
- Comment: info.Comment,
- Config: &config,
- Created: l.Created().Format(time.RFC3339Nano),
- DockerVersion: info.Version,
- GraphDriver: graphDriver,
- ID: "sha256:" + l.ID(),
- Metadata: docker.ImageMetadata{},
- Os: info.Os,
- OsVersion: info.Version,
- Parent: info.Parent,
- RepoDigests: info.RepoDigests,
- RepoTags: info.RepoTags,
- RootFS: rootfs,
- Size: info.Size,
- Variant: "",
- VirtualSize: info.VirtualSize,
+ Architecture: info.Architecture,
+ Author: info.Author,
+ Comment: info.Comment,
+ Config: &config,
+ ContainerConfig: cc,
+ Created: l.Created().Format(time.RFC3339Nano),
+ DockerVersion: info.Version,
+ GraphDriver: graphDriver,
+ ID: "sha256:" + l.ID(),
+ Metadata: docker.ImageMetadata{},
+ Os: info.Os,
+ OsVersion: info.Version,
+ Parent: info.Parent,
+ RepoDigests: info.RepoDigests,
+ RepoTags: info.RepoTags,
+ RootFS: rootfs,
+ Size: info.Size,
+ Variant: "",
+ VirtualSize: info.VirtualSize,
}
- // TODO: consider filling the container config.
return &ImageInspect{dockerImageInspect}, nil
}