mirror of
https://github.com/containers/podman.git
synced 2025-07-15 03:02:52 +08:00
Refactor spec generation in libpod into a function
Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #386 Approved by: baude
This commit is contained in:
@ -643,3 +643,15 @@ 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]
|
||||
}
|
||||
|
Reference in New Issue
Block a user