mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-25 03:34:58 +00:00
Merge pull request #1482 from justincormack/split-inspect
Split out OCI generation function
This commit is contained in:
commit
87ebac9976
@ -10,6 +10,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
log "github.com/Sirupsen/logrus"
|
log "github.com/Sirupsen/logrus"
|
||||||
|
"github.com/docker/engine-api/types"
|
||||||
"github.com/opencontainers/runtime-spec/specs-go"
|
"github.com/opencontainers/runtime-spec/specs-go"
|
||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
)
|
)
|
||||||
@ -76,7 +77,6 @@ func NewConfig(config []byte) (*Moby, error) {
|
|||||||
|
|
||||||
// ConfigToOCI converts a config specification to an OCI config file
|
// ConfigToOCI converts a config specification to an OCI config file
|
||||||
func ConfigToOCI(image *MobyImage) ([]byte, error) {
|
func ConfigToOCI(image *MobyImage) ([]byte, error) {
|
||||||
oci := specs.Spec{}
|
|
||||||
|
|
||||||
// TODO pass through same docker client to all functions
|
// TODO pass through same docker client to all functions
|
||||||
cli, err := dockerClient()
|
cli, err := dockerClient()
|
||||||
@ -89,6 +89,13 @@ func ConfigToOCI(image *MobyImage) ([]byte, error) {
|
|||||||
return []byte{}, err
|
return []byte{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return ConfigInspectToOCI(image, inspect)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ConfigInspectToOCI converts a config and the output of image inspect to an OCI config file
|
||||||
|
func ConfigInspectToOCI(image *MobyImage, inspect types.ImageInspect) ([]byte, error) {
|
||||||
|
oci := specs.Spec{}
|
||||||
|
|
||||||
config := inspect.Config
|
config := inspect.Config
|
||||||
if config == nil {
|
if config == nil {
|
||||||
return []byte{}, errors.New("empty image config")
|
return []byte{}, errors.New("empty image config")
|
||||||
|
Loading…
Reference in New Issue
Block a user