oci: use mediatype helpers
Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
This commit is contained in:
parent
cdba61603c
commit
0ba5b4b62c
@ -376,27 +376,25 @@ func WithImageConfigArgs(image Image, args []string) SpecOpts {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if !images.IsConfigType(ic.MediaType) {
|
||||||
|
return fmt.Errorf("unknown image config media type %s", ic.MediaType)
|
||||||
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
imageConfigBytes []byte
|
imageConfigBytes []byte
|
||||||
ociimage v1.Image
|
ociimage v1.Image
|
||||||
config v1.ImageConfig
|
config v1.ImageConfig
|
||||||
)
|
)
|
||||||
switch ic.MediaType {
|
imageConfigBytes, err = content.ReadBlob(ctx, image.ContentStore(), ic)
|
||||||
case v1.MediaTypeImageConfig, images.MediaTypeDockerSchema2Config:
|
if err != nil {
|
||||||
var err error
|
return err
|
||||||
imageConfigBytes, err = content.ReadBlob(ctx, image.ContentStore(), ic)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := json.Unmarshal(imageConfigBytes, &ociimage); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
config = ociimage.Config
|
|
||||||
default:
|
|
||||||
return fmt.Errorf("unknown image config media type %s", ic.MediaType)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err = json.Unmarshal(imageConfigBytes, &ociimage); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
config = ociimage.Config
|
||||||
|
|
||||||
appendOSMounts(s, ociimage.OS)
|
appendOSMounts(s, ociimage.OS)
|
||||||
setProcess(s)
|
setProcess(s)
|
||||||
if s.Linux != nil {
|
if s.Linux != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user