diff options
Diffstat (limited to 'libpod/container.go')
-rw-r--r-- | libpod/container.go | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/libpod/container.go b/libpod/container.go index 831e4e886..0e3b8b17f 100644 --- a/libpod/container.go +++ b/libpod/container.go @@ -466,6 +466,21 @@ func (c *Container) RuntimeName() string { return c.runtime.ociRuntime.name } +// Runtime spec accessors +// Unlocked + +// Hostname gets the container's hostname +func (c *Container) Hostname() string { + if c.config.Spec.Hostname != "" { + return c.config.Spec.Hostname + } + + if len(c.ID()) < 11 { + return c.ID() + } + return c.ID()[:12] +} + // State Accessors // Require locking @@ -643,15 +658,3 @@ func (c *Container) RWSize() (int64, error) { } return c.rwSize() } - -// Hostname gets the container's hostname -func (c *Container) Hostname() string { - if c.config.Spec.Hostname != "" { - return c.config.Spec.Hostname - } - - if len(c.ID()) < 11 { - return c.ID() - } - return c.ID()[:12] -} |