diff options
author | Matthew Heon <matthew.heon@gmail.com> | 2018-05-01 12:18:06 -0400 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-05-03 12:23:12 +0000 |
commit | dd569a91f42581156b38583245bec6bf71a5ad21 (patch) | |
tree | 45f3404d4ffe0966db6ff162738f6ebb4a5aae82 | |
parent | ab7e2a695633dbe45b0af3332b813b0efdfbf203 (diff) | |
download | podman-dd569a91f42581156b38583245bec6bf71a5ad21.tar.gz podman-dd569a91f42581156b38583245bec6bf71a5ad21.tar.bz2 podman-dd569a91f42581156b38583245bec6bf71a5ad21.zip |
Add accessors for new image fields in container config
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
Closes: #700
Approved by: rhatdan
-rw-r--r-- | libpod/container.go | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/libpod/container.go b/libpod/container.go index f70856d67..e7fe77498 100644 --- a/libpod/container.go +++ b/libpod/container.go @@ -473,6 +473,40 @@ func (c *Container) HostsAdd() []string { return c.config.HostAdd } +// UserVolumes returns user-added volume mounts in the container. +// These are not added to the spec, but are used during image commit and to +// trigger some OCI hooks. +func (c *Container) UserVolumes() []string { + volumes := make([]string, 0, len(c.config.UserVolumes)) + for _, vol := range c.config.UserVolumes { + volumes = append(volumes, vol) + } + + return volumes +} + +// Entrypoint is the container's entrypoint. +// This is not added to the spec, but is instead used during image commit. +func (c *Container) Entrypoint() []string { + entrypoint := make([]string, 0, len(c.config.Entrypoint)) + for _, str := range c.config.Entrypoint { + entrypoint = append(entrypoint, str) + } + + return entrypoint +} + +// Command is the container's command +// This is not added to the spec, but is instead used during image commit +func (c *Container) Command() []string { + command := make([]string, 0, len(c.config.Command)) + for _, str := range c.config.Command { + command = append(command, str) + } + + return command +} + // Stdin returns whether STDIN on the container will be kept open func (c *Container) Stdin() bool { return c.config.Stdin |