aboutsummaryrefslogtreecommitdiff
path: root/libpod/storage.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2018-05-01 12:08:52 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-05-03 12:23:12 +0000
commitab7e2a695633dbe45b0af3332b813b0efdfbf203 (patch)
tree74de1a9b76fbc3ab628f083561ed60c2576836be /libpod/storage.go
parent16c997de624be049dda5d2182ec70d979194b002 (diff)
downloadpodman-ab7e2a695633dbe45b0af3332b813b0efdfbf203.tar.gz
podman-ab7e2a695633dbe45b0af3332b813b0efdfbf203.tar.bz2
podman-ab7e2a695633dbe45b0af3332b813b0efdfbf203.zip
Store user Volumes, Entrypoint, Command in database
We need these for commit, and they cannot be properly deduced from just the OCI spec, so save them in the database so we can retrieve them for commit. Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #700 Approved by: rhatdan
Diffstat (limited to 'libpod/storage.go')
-rw-r--r--libpod/storage.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/libpod/storage.go b/libpod/storage.go
index ee9ecbda4..910db1970 100644
--- a/libpod/storage.go
+++ b/libpod/storage.go
@@ -8,6 +8,7 @@ import (
istorage "github.com/containers/image/storage"
"github.com/containers/image/types"
"github.com/containers/storage"
+ "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
@@ -29,6 +30,7 @@ func getStorageService(store storage.Store) (*storageService, error) {
type ContainerInfo struct {
Dir string
RunDir string
+ Config *v1.Image
}
// RuntimeContainerMetadata is the structure that we encode as JSON and store
@@ -65,7 +67,7 @@ func (r *storageService) CreateContainerStorage(ctx context.Context, systemConte
if containerName == "" {
return ContainerInfo{}, ErrEmptyID
}
- //// Check if we have the specified image.
+ // Check if we have the specified image.
ref, err := istorage.Transport.ParseStoreReference(r.store, imageID)
if err != nil {
return ContainerInfo{}, err
@@ -81,6 +83,12 @@ func (r *storageService) CreateContainerStorage(ctx context.Context, systemConte
}
defer image.Close()
+ // Get OCI configuration of image
+ imageConfig, err := image.OCIConfig(ctx)
+ if err != nil {
+ return ContainerInfo{}, err
+ }
+
// Update the image name and ID.
if imageName == "" && len(img.Names) > 0 {
imageName = img.Names[0]
@@ -159,6 +167,7 @@ func (r *storageService) CreateContainerStorage(ctx context.Context, systemConte
return ContainerInfo{
Dir: containerDir,
RunDir: containerRunDir,
+ Config: imageConfig,
}, nil
}