mirror of
https://github.com/containers/podman.git
synced 2025-06-17 15:08:08 +08:00
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>
This commit is contained in:
@ -232,27 +232,32 @@ func ImageDataToImageInspect(ctx context.Context, l *libimage.Image) (*ImageInsp
|
|||||||
Name: info.GraphDriver.Name,
|
Name: info.GraphDriver.Name,
|
||||||
Data: info.GraphDriver.Data,
|
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{
|
dockerImageInspect := docker.ImageInspect{
|
||||||
Architecture: info.Architecture,
|
Architecture: info.Architecture,
|
||||||
Author: info.Author,
|
Author: info.Author,
|
||||||
Comment: info.Comment,
|
Comment: info.Comment,
|
||||||
Config: &config,
|
Config: &config,
|
||||||
Created: l.Created().Format(time.RFC3339Nano),
|
ContainerConfig: cc,
|
||||||
DockerVersion: info.Version,
|
Created: l.Created().Format(time.RFC3339Nano),
|
||||||
GraphDriver: graphDriver,
|
DockerVersion: info.Version,
|
||||||
ID: "sha256:" + l.ID(),
|
GraphDriver: graphDriver,
|
||||||
Metadata: docker.ImageMetadata{},
|
ID: "sha256:" + l.ID(),
|
||||||
Os: info.Os,
|
Metadata: docker.ImageMetadata{},
|
||||||
OsVersion: info.Version,
|
Os: info.Os,
|
||||||
Parent: info.Parent,
|
OsVersion: info.Version,
|
||||||
RepoDigests: info.RepoDigests,
|
Parent: info.Parent,
|
||||||
RepoTags: info.RepoTags,
|
RepoDigests: info.RepoDigests,
|
||||||
RootFS: rootfs,
|
RepoTags: info.RepoTags,
|
||||||
Size: info.Size,
|
RootFS: rootfs,
|
||||||
Variant: "",
|
Size: info.Size,
|
||||||
VirtualSize: info.VirtualSize,
|
Variant: "",
|
||||||
|
VirtualSize: info.VirtualSize,
|
||||||
}
|
}
|
||||||
// TODO: consider filling the container config.
|
|
||||||
return &ImageInspect{dockerImageInspect}, nil
|
return &ImageInspect{dockerImageInspect}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
test/compose/uptwice/Dockerfile
Normal file
2
test/compose/uptwice/Dockerfile
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
FROM alpine
|
||||||
|
WORKDIR /app
|
5
test/compose/uptwice/docker-compose.yml
Normal file
5
test/compose/uptwice/docker-compose.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
version: '3'
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
build: .
|
||||||
|
command: sleep 10002
|
4
test/compose/uptwice/tests.sh
Normal file
4
test/compose/uptwice/tests.sh
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# -*- bash -*-
|
||||||
|
|
||||||
|
sed -i -e 's/10001/10002/' docker-compose.yml
|
||||||
|
docker-compose up -d
|
Reference in New Issue
Block a user