Browse code

Set the container's hostname to the truncated ID

Solomon Hykes authored on 2013/03/27 05:14:44
Showing 1 changed files
... ...
@@ -69,9 +69,15 @@ func (runtime *Runtime) Create(config *Config) (*Container, error) {
69 69
 	if err != nil {
70 70
 		return nil, err
71 71
 	}
72
+	// Generate id
73
+	id := GenerateId()
74
+	// Generate default hostname
75
+	if config.Hostname == "" {
76
+		config.Hostname = id[:12]
77
+	}
72 78
 	container := &Container{
73 79
 		// FIXME: we should generate the ID here instead of receiving it as an argument
74
-		Id:              GenerateId(),
80
+		Id:              id,
75 81
 		Created:         time.Now(),
76 82
 		Path:            config.Cmd[0],
77 83
 		Args:            config.Cmd[1:], //FIXME: de-duplicate from config