Merge pull request #10893 from baude/issue10795

Add container config to compat image inspect
This commit is contained in:
OpenShift Merge Robot 2021-07-09 14:04:08 -04:00 committed by GitHub
commit ec97739712
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 35 additions and 19 deletions

View File

@ -232,11 +232,17 @@ 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,
ContainerConfig: cc,
Created: l.Created().Format(time.RFC3339Nano),
DockerVersion: info.Version,
GraphDriver: graphDriver,
@ -252,7 +258,6 @@ func ImageDataToImageInspect(ctx context.Context, l *libimage.Image) (*ImageInsp
Variant: "",
VirtualSize: info.VirtualSize,
}
// TODO: consider filling the container config.
return &ImageInspect{dockerImageInspect}, nil
}

View File

@ -0,0 +1,2 @@
FROM alpine
WORKDIR /app

View File

@ -0,0 +1,5 @@
version: '3'
services:
app:
build: .
command: sleep 10002

View File

@ -0,0 +1,4 @@
# -*- bash -*-
sed -i -e 's/10001/10002/' docker-compose.yml
docker-compose up -d