summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-07-09 14:04:08 -0400
committerGitHub <noreply@github.com>2021-07-09 14:04:08 -0400
commitec97739712336dbb0553c40560b7d84d035cd74b (patch)
treed0babe6ec89af6006f4645d1f9e9c61bca97689f
parent43abe006a3d8026b6cc7deace0a29a08a5d4bc08 (diff)
parentdaebdf3859ad3c912b068ea6b48e49f23c9ed0c2 (diff)
downloadpodman-ec97739712336dbb0553c40560b7d84d035cd74b.tar.gz
podman-ec97739712336dbb0553c40560b7d84d035cd74b.tar.bz2
podman-ec97739712336dbb0553c40560b7d84d035cd74b.zip
Merge pull request #10893 from baude/issue10795
Add container config to compat image inspect
-rw-r--r--pkg/api/handlers/types.go43
-rw-r--r--test/compose/uptwice/Dockerfile2
-rw-r--r--test/compose/uptwice/docker-compose.yml5
-rw-r--r--test/compose/uptwice/tests.sh4
4 files changed, 35 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
}
diff --git a/test/compose/uptwice/Dockerfile b/test/compose/uptwice/Dockerfile
new file mode 100644
index 000000000..b993af04d
--- /dev/null
+++ b/test/compose/uptwice/Dockerfile
@@ -0,0 +1,2 @@
+FROM alpine
+WORKDIR /app
diff --git a/test/compose/uptwice/docker-compose.yml b/test/compose/uptwice/docker-compose.yml
new file mode 100644
index 000000000..e06f9e554
--- /dev/null
+++ b/test/compose/uptwice/docker-compose.yml
@@ -0,0 +1,5 @@
+version: '3'
+services:
+ app:
+ build: .
+ command: sleep 10002
diff --git a/test/compose/uptwice/tests.sh b/test/compose/uptwice/tests.sh
new file mode 100644
index 000000000..291694d83
--- /dev/null
+++ b/test/compose/uptwice/tests.sh
@@ -0,0 +1,4 @@
+# -*- bash -*-
+
+sed -i -e 's/10001/10002/' docker-compose.yml
+docker-compose up -d