From 60f33c5a95fd6f157daa1812b1b2b595476a9004 Mon Sep 17 00:00:00 2001 From: Solomon Hykes Date: Tue, 26 Mar 2013 13:14:44 -0700 Subject: [PATCH] Set the container's hostname to the truncated ID Upstream-commit: 54fa59c8ec0e20c709cc7b2049f19271750adaab Component: engine --- components/engine/runtime.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/components/engine/runtime.go b/components/engine/runtime.go index 4c11cc9c99..8c56f9acd9 100644 --- a/components/engine/runtime.go +++ b/components/engine/runtime.go @@ -69,9 +69,15 @@ func (runtime *Runtime) Create(config *Config) (*Container, error) { if err != nil { return nil, err } + // Generate id + id := GenerateId() + // Generate default hostname + if config.Hostname == "" { + config.Hostname = id[:12] + } container := &Container{ // FIXME: we should generate the ID here instead of receiving it as an argument - Id: GenerateId(), + Id: id, Created: time.Now(), Path: config.Cmd[0], Args: config.Cmd[1:], //FIXME: de-duplicate from config