diff options
author | Matthew Heon <matthew.heon@gmail.com> | 2017-11-22 12:21:53 -0500 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2017-11-22 18:12:57 +0000 |
commit | 34ba0cb8a922347364afaa14f199409ad7dc2451 (patch) | |
tree | 23fa7811dcf3de1501399f76373dc13bf4744d64 /libpod/container.go | |
parent | bd4e106de3d890bd2b0520083c9ad7d314b61487 (diff) | |
download | podman-34ba0cb8a922347364afaa14f199409ad7dc2451.tar.gz podman-34ba0cb8a922347364afaa14f199409ad7dc2451.tar.bz2 podman-34ba0cb8a922347364afaa14f199409ad7dc2451.zip |
Order containers returned from state and make container config public
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
Closes: #63
Approved by: baude
Diffstat (limited to 'libpod/container.go')
-rw-r--r-- | libpod/container.go | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/libpod/container.go b/libpod/container.go index 9b48d2ca1..8ad0bb10d 100644 --- a/libpod/container.go +++ b/libpod/container.go @@ -46,7 +46,7 @@ const ( // Container is a single OCI container type Container struct { - config *containerConfig + config *ContainerConfig pod *Pod runningSpec *spec.Spec @@ -59,7 +59,7 @@ type Container struct { runtime *Runtime } -// containerState contains the current state of the container +// containerRuntimeInfo contains the current state of the container // It is stored on disk in a tmpfs and recreated on reboot type containerRuntimeInfo struct { // The current state of the running container @@ -88,10 +88,10 @@ type containerRuntimeInfo struct { // TODO: Save information about image used in container if one is used } -// containerConfig contains all information that was used to create the +// ContainerConfig contains all information that was used to create the // container. It may not be changed once created. // It is stored, read-only, on disk -type containerConfig struct { +type ContainerConfig struct { Spec *spec.Spec `json:"spec"` ID string `json:"id"` Name string `json:"name"` @@ -153,6 +153,14 @@ func (c *Container) Labels() map[string]string { return labels } +// Config returns the configuration used to create the container +func (c *Container) Config() *ContainerConfig { + returnConfig := new(ContainerConfig) + deepcopier.Copy(c.config).To(returnConfig) + + return returnConfig +} + // LogPath returns the path to the container's log file // This file will only be present after Init() is called to create the container // in runc @@ -235,7 +243,7 @@ func newContainer(rspec *spec.Spec) (*Container, error) { } ctr := new(Container) - ctr.config = new(containerConfig) + ctr.config = new(ContainerConfig) ctr.state = new(containerRuntimeInfo) ctr.config.ID = stringid.GenerateNonCryptoID() |