diff options
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/api/handlers/libpod/images.go | 2 | ||||
-rw-r--r-- | pkg/api/handlers/types.go | 2 | ||||
-rw-r--r-- | pkg/domain/entities/images.go | 4 | ||||
-rw-r--r-- | pkg/domain/infra/abi/containers.go | 10 | ||||
-rw-r--r-- | pkg/domain/infra/abi/images_list.go | 2 |
5 files changed, 15 insertions, 5 deletions
diff --git a/pkg/api/handlers/libpod/images.go b/pkg/api/handlers/libpod/images.go index a42d06205..284b33637 100644 --- a/pkg/api/handlers/libpod/images.go +++ b/pkg/api/handlers/libpod/images.go @@ -111,7 +111,7 @@ func GetImages(w http.ResponseWriter, r *http.Request) { return } // libpod has additional fields that we need to populate. - is.Created = img.Created().Unix() + is.Created = img.Created() is.ReadOnly = img.IsReadOnly() summaries[j] = is } diff --git a/pkg/api/handlers/types.go b/pkg/api/handlers/types.go index f402da064..4c081cf85 100644 --- a/pkg/api/handlers/types.go +++ b/pkg/api/handlers/types.go @@ -262,7 +262,7 @@ func ImageToImageSummary(l *libpodImage.Image) (*entities.ImageSummary, error) { ID: l.ID(), ParentId: l.Parent, RepoTags: repoTags, - Created: l.Created().Unix(), + Created: l.Created(), Size: int64(*size), SharedSize: 0, VirtualSize: l.VirtualSize, diff --git a/pkg/domain/entities/images.go b/pkg/domain/entities/images.go index 78ebb8805..3a6d159e4 100644 --- a/pkg/domain/entities/images.go +++ b/pkg/domain/entities/images.go @@ -50,10 +50,10 @@ func (i *Image) Id() string { } type ImageSummary struct { - ID string `json:"Id"` + ID string ParentId string `json:",omitempty"` RepoTags []string `json:",omitempty"` - Created int64 `json:",omitempty"` + Created time.Time `json:",omitempty"` Size int64 `json:",omitempty"` SharedSize int `json:",omitempty"` VirtualSize int64 `json:",omitempty"` diff --git a/pkg/domain/infra/abi/containers.go b/pkg/domain/infra/abi/containers.go index c9df72f2d..50003dbe2 100644 --- a/pkg/domain/infra/abi/containers.go +++ b/pkg/domain/infra/abi/containers.go @@ -736,6 +736,16 @@ func (ic *ContainerEngine) ContainerRun(ctx context.Context, opts entities.Conta } else { report.ExitCode = int(ecode) } + if opts.Rm { + if err := ic.Libpod.RemoveContainer(ctx, ctr, false, true); err != nil { + if errors.Cause(err) == define.ErrNoSuchCtr || + errors.Cause(err) == define.ErrCtrRemoved { + logrus.Warnf("Container %s does not exist: %v", ctr.ID(), err) + } else { + logrus.Errorf("Error removing container %s: %v", ctr.ID(), err) + } + } + } return &report, nil } diff --git a/pkg/domain/infra/abi/images_list.go b/pkg/domain/infra/abi/images_list.go index 2f4020374..68b961cb6 100644 --- a/pkg/domain/infra/abi/images_list.go +++ b/pkg/domain/infra/abi/images_list.go @@ -54,7 +54,7 @@ func (ir *ImageEngine) List(ctx context.Context, opts entities.ImageListOptions) ID: img.ID(), ConfigDigest: string(img.ConfigDigest), - Created: img.Created().Unix(), + Created: img.Created(), Dangling: img.Dangling(), Digest: string(img.Digest()), Digests: digests, |