Add accessors for new image fields in container config

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #700
Approved by: rhatdan
This commit is contained in:
Matthew Heon
2018-05-01 12:18:06 -04:00
committed by Atomic Bot
parent ab7e2a6956
commit dd569a91f4

View File

@ -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