Browse code

Renamed Docker{} to Runtime{} for clarity

Solomon Hykes authored on 2013/03/21 16:41:15
Showing 5 changed files
... ...
@@ -116,7 +116,7 @@ func (srv *Server) CmdWait(stdin io.ReadCloser, stdout io.Writer, args ...string
116 116
 		return nil
117 117
 	}
118 118
 	for _, name := range cmd.Args() {
119
-		if container := srv.containers.Get(name); container != nil {
119
+		if container := srv.runtime.Get(name); container != nil {
120 120
 			fmt.Fprintln(stdout, container.Wait())
121 121
 		} else {
122 122
 			return errors.New("No such container: " + name)
... ...
@@ -133,7 +133,7 @@ func (srv *Server) CmdVersion(stdin io.ReadCloser, stdout io.Writer, args ...str
133 133
 
134 134
 // 'docker info': display system-wide information.
135 135
 func (srv *Server) CmdInfo(stdin io.ReadCloser, stdout io.Writer, args ...string) error {
136
-	images, _ := srv.containers.graph.All()
136
+	images, _ := srv.runtime.graph.All()
137 137
 	var imgcount int
138 138
 	if images == nil {
139 139
 		imgcount = 0
... ...
@@ -149,7 +149,7 @@ func (srv *Server) CmdInfo(stdin io.ReadCloser, stdout io.Writer, args ...string
149 149
 		return nil
150 150
 	}
151 151
 	fmt.Fprintf(stdout, "containers: %d\nversion: %s\nimages: %d\n",
152
-		len(srv.containers.List()),
152
+		len(srv.runtime.List()),
153 153
 		VERSION,
154 154
 		imgcount)
155 155
 	return nil
... ...
@@ -165,7 +165,7 @@ func (srv *Server) CmdStop(stdin io.ReadCloser, stdout io.Writer, args ...string
165 165
 		return nil
166 166
 	}
167 167
 	for _, name := range cmd.Args() {
168
-		if container := srv.containers.Get(name); container != nil {
168
+		if container := srv.runtime.Get(name); container != nil {
169 169
 			if err := container.Stop(); err != nil {
170 170
 				return err
171 171
 			}
... ...
@@ -187,7 +187,7 @@ func (srv *Server) CmdRestart(stdin io.ReadCloser, stdout io.Writer, args ...str
187 187
 		return nil
188 188
 	}
189 189
 	for _, name := range cmd.Args() {
190
-		if container := srv.containers.Get(name); container != nil {
190
+		if container := srv.runtime.Get(name); container != nil {
191 191
 			if err := container.Restart(); err != nil {
192 192
 				return err
193 193
 			}
... ...
@@ -209,7 +209,7 @@ func (srv *Server) CmdStart(stdin io.ReadCloser, stdout io.Writer, args ...strin
209 209
 		return nil
210 210
 	}
211 211
 	for _, name := range cmd.Args() {
212
-		if container := srv.containers.Get(name); container != nil {
212
+		if container := srv.runtime.Get(name); container != nil {
213 213
 			if err := container.Start(); err != nil {
214 214
 				return err
215 215
 			}
... ...
@@ -231,7 +231,7 @@ func (srv *Server) CmdMount(stdin io.ReadCloser, stdout io.Writer, args ...strin
231 231
 		return nil
232 232
 	}
233 233
 	for _, name := range cmd.Args() {
234
-		if container := srv.containers.Get(name); container != nil {
234
+		if container := srv.runtime.Get(name); container != nil {
235 235
 			if err := container.EnsureMounted(); err != nil {
236 236
 				return err
237 237
 			}
... ...
@@ -254,9 +254,9 @@ func (srv *Server) CmdInspect(stdin io.ReadCloser, stdout io.Writer, args ...str
254 254
 	}
255 255
 	name := cmd.Arg(0)
256 256
 	var obj interface{}
257
-	if container := srv.containers.Get(name); container != nil {
257
+	if container := srv.runtime.Get(name); container != nil {
258 258
 		obj = container
259
-	} else if image, err := srv.containers.graph.Get(name); err != nil {
259
+	} else if image, err := srv.runtime.graph.Get(name); err != nil {
260 260
 		return err
261 261
 	} else if image != nil {
262 262
 		obj = image
... ...
@@ -291,7 +291,7 @@ func (srv *Server) CmdPort(stdin io.ReadCloser, stdout io.Writer, args ...string
291 291
 	}
292 292
 	name := cmd.Arg(0)
293 293
 	privatePort := cmd.Arg(1)
294
-	if container := srv.containers.Get(name); container == nil {
294
+	if container := srv.runtime.Get(name); container == nil {
295 295
 		return errors.New("No such container: " + name)
296 296
 	} else {
297 297
 		if frontend, exists := container.NetworkSettings.PortMapping[privatePort]; !exists {
... ...
@@ -311,7 +311,7 @@ func (srv *Server) CmdRmi(stdin io.ReadCloser, stdout io.Writer, args ...string)
311 311
 		return nil
312 312
 	}
313 313
 	for _, name := range cmd.Args() {
314
-		if err := srv.containers.graph.Delete(name); err != nil {
314
+		if err := srv.runtime.graph.Delete(name); err != nil {
315 315
 			return err
316 316
 		}
317 317
 	}
... ...
@@ -324,11 +324,11 @@ func (srv *Server) CmdRm(stdin io.ReadCloser, stdout io.Writer, args ...string)
324 324
 		return nil
325 325
 	}
326 326
 	for _, name := range cmd.Args() {
327
-		container := srv.containers.Get(name)
327
+		container := srv.runtime.Get(name)
328 328
 		if container == nil {
329 329
 			return errors.New("No such container: " + name)
330 330
 		}
331
-		if err := srv.containers.Destroy(container); err != nil {
331
+		if err := srv.runtime.Destroy(container); err != nil {
332 332
 			fmt.Fprintln(stdout, "Error destroying container "+name+": "+err.Error())
333 333
 		}
334 334
 	}
... ...
@@ -342,7 +342,7 @@ func (srv *Server) CmdKill(stdin io.ReadCloser, stdout io.Writer, args ...string
342 342
 		return nil
343 343
 	}
344 344
 	for _, name := range cmd.Args() {
345
-		container := srv.containers.Get(name)
345
+		container := srv.runtime.Get(name)
346 346
 		if container == nil {
347 347
 			return errors.New("No such container: " + name)
348 348
 		}
... ...
@@ -390,7 +390,7 @@ func (srv *Server) CmdImport(stdin io.ReadCloser, stdout io.Writer, args ...stri
390 390
 		archive = future.ProgressReader(resp.Body, int(resp.ContentLength), stdout)
391 391
 	}
392 392
 	fmt.Fprintf(stdout, "Unpacking to %s\n", name)
393
-	img, err := srv.containers.graph.Create(archive, "", "")
393
+	img, err := srv.runtime.graph.Create(archive, "", "")
394 394
 	if err != nil {
395 395
 		return err
396 396
 	}
... ...
@@ -420,7 +420,7 @@ func (srv *Server) CmdImages(stdin io.ReadCloser, stdout io.Writer, args ...stri
420 420
 		fmt.Fprintf(w, "NAME\tID\tCREATED\tPARENT\n")
421 421
 	}
422 422
 	if *quiet {
423
-		images, err := srv.containers.graph.All()
423
+		images, err := srv.runtime.graph.All()
424 424
 		if err != nil {
425 425
 			return err
426 426
 		}
... ...
@@ -486,7 +486,7 @@ func (srv *Server) CmdPs(stdin io.ReadCloser, stdout io.Writer, args ...string)
486 486
 	if !*quiet {
487 487
 		fmt.Fprintf(w, "ID\tIMAGE\tCOMMAND\tCREATED\tSTATUS\tCOMMENT\n")
488 488
 	}
489
-	for _, container := range srv.containers.List() {
489
+	for _, container := range srv.runtime.List() {
490 490
 		if !container.State.Running && !*fl_all {
491 491
 			continue
492 492
 		}
... ...
@@ -532,7 +532,7 @@ func (srv *Server) CmdCommit(stdin io.ReadCloser, stdout io.Writer, args ...stri
532 532
 		cmd.Usage()
533 533
 		return nil
534 534
 	}
535
-	if container := srv.containers.Get(containerName); container != nil {
535
+	if container := srv.runtime.Get(containerName); container != nil {
536 536
 		// FIXME: freeze the container before copying it to avoid data corruption?
537 537
 		// FIXME: this shouldn't be in commands.
538 538
 		rwTar, err := container.ExportRw()
... ...
@@ -540,7 +540,7 @@ func (srv *Server) CmdCommit(stdin io.ReadCloser, stdout io.Writer, args ...stri
540 540
 			return err
541 541
 		}
542 542
 		// Create a new image from the container's base layers + a new layer from container changes
543
-		img, err := srv.containers.graph.Create(rwTar, container.Image, "")
543
+		img, err := srv.runtime.graph.Create(rwTar, container.Image, "")
544 544
 		if err != nil {
545 545
 			return err
546 546
 		}
... ...
@@ -563,7 +563,7 @@ func (srv *Server) CmdTar(stdin io.ReadCloser, stdout io.Writer, args ...string)
563 563
 		return errors.New("Sparse mode not yet implemented") // FIXME
564 564
 	}
565 565
 	name := cmd.Arg(0)
566
-	if container := srv.containers.Get(name); container != nil {
566
+	if container := srv.runtime.Get(name); container != nil {
567 567
 		if err := container.EnsureMounted(); err != nil {
568 568
 			return err
569 569
 		}
... ...
@@ -590,7 +590,7 @@ func (srv *Server) CmdDiff(stdin io.ReadCloser, stdout io.Writer, args ...string
590 590
 	if cmd.NArg() < 1 {
591 591
 		return errors.New("Not enough arguments")
592 592
 	}
593
-	if container := srv.containers.Get(cmd.Arg(0)); container == nil {
593
+	if container := srv.runtime.Get(cmd.Arg(0)); container == nil {
594 594
 		return errors.New("No such container")
595 595
 	} else {
596 596
 		changes, err := container.Changes()
... ...
@@ -614,7 +614,7 @@ func (srv *Server) CmdLogs(stdin io.ReadCloser, stdout io.Writer, args ...string
614 614
 		return nil
615 615
 	}
616 616
 	name := cmd.Arg(0)
617
-	if container := srv.containers.Get(name); container != nil {
617
+	if container := srv.runtime.Get(name); container != nil {
618 618
 		log_stdout, err := container.ReadLog("stdout")
619 619
 		if err != nil {
620 620
 			return err
... ...
@@ -649,7 +649,7 @@ func (srv *Server) CmdAttach(stdin io.ReadCloser, stdout io.Writer, args ...stri
649 649
 		return nil
650 650
 	}
651 651
 	name := cmd.Arg(0)
652
-	container := srv.containers.Get(name)
652
+	container := srv.runtime.Get(name)
653 653
 	if container == nil {
654 654
 		return errors.New("No such container: " + name)
655 655
 	}
... ...
@@ -731,7 +731,7 @@ func (srv *Server) CmdRun(stdin io.ReadCloser, stdout io.Writer, args ...string)
731 731
 	}
732 732
 
733 733
 	// Create new container
734
-	container, err := srv.containers.Create(cmdline[0], cmdline[1:], name,
734
+	container, err := srv.runtime.Create(cmdline[0], cmdline[1:], name,
735 735
 		&Config{
736 736
 			Ports:     fl_ports,
737 737
 			User:      *fl_user,
... ...
@@ -799,16 +799,16 @@ func NewServer() (*Server, error) {
799 799
 	// if err != nil {
800 800
 	// 	return nil, err
801 801
 	// }
802
-	containers, err := New()
802
+	runtime, err := New()
803 803
 	if err != nil {
804 804
 		return nil, err
805 805
 	}
806 806
 	srv := &Server{
807
-		containers: containers,
807
+		runtime: runtime,
808 808
 	}
809 809
 	return srv, nil
810 810
 }
811 811
 
812 812
 type Server struct {
813
-	containers *Docker
813
+	runtime *Runtime
814 814
 }
... ...
@@ -45,7 +45,7 @@ type Container struct {
45 45
 
46 46
 	stdoutLog *os.File
47 47
 	stderrLog *os.File
48
-	runtime   *Docker // FIXME: rename Docker to Runtime for clarity
48
+	runtime   *Runtime
49 49
 }
50 50
 
51 51
 type Config struct {
... ...
@@ -14,15 +14,15 @@ import (
14 14
 )
15 15
 
16 16
 func TestCommitRun(t *testing.T) {
17
-	docker, err := newTestDocker()
17
+	runtime, err := newTestRuntime()
18 18
 	if err != nil {
19 19
 		t.Fatal(err)
20 20
 	}
21
-	defer nuke(docker)
22
-	container1, err := docker.Create(
21
+	defer nuke(runtime)
22
+	container1, err := runtime.Create(
23 23
 		"/bin/sh",
24 24
 		[]string{"-c", "echo hello > /world"},
25
-		GetTestImage(docker).Id,
25
+		GetTestImage(runtime).Id,
26 26
 		&Config{
27 27
 			Memory: 33554432,
28 28
 		},
... ...
@@ -30,7 +30,7 @@ func TestCommitRun(t *testing.T) {
30 30
 	if err != nil {
31 31
 		t.Fatal(err)
32 32
 	}
33
-	defer docker.Destroy(container1)
33
+	defer runtime.Destroy(container1)
34 34
 
35 35
 	if container1.State.Running {
36 36
 		t.Errorf("Container shouldn't be running")
... ...
@@ -46,14 +46,14 @@ func TestCommitRun(t *testing.T) {
46 46
 	if err != nil {
47 47
 		t.Error(err)
48 48
 	}
49
-	img, err := docker.graph.Create(rwTar, container1.Image, "unit test commited image")
49
+	img, err := runtime.graph.Create(rwTar, container1.Image, "unit test commited image")
50 50
 	if err != nil {
51 51
 		t.Error(err)
52 52
 	}
53 53
 
54 54
 	// FIXME: Make a TestCommit that stops here and check docker.root/layers/img.id/world
55 55
 
56
-	container2, err := docker.Create(
56
+	container2, err := runtime.Create(
57 57
 		"cat",
58 58
 		[]string{"/world"},
59 59
 		img.Id,
... ...
@@ -64,7 +64,7 @@ func TestCommitRun(t *testing.T) {
64 64
 	if err != nil {
65 65
 		t.Fatal(err)
66 66
 	}
67
-	defer docker.Destroy(container2)
67
+	defer runtime.Destroy(container2)
68 68
 
69 69
 	stdout, err := container2.StdoutPipe()
70 70
 	stderr, err := container2.StderrPipe()
... ...
@@ -82,15 +82,15 @@ func TestCommitRun(t *testing.T) {
82 82
 }
83 83
 
84 84
 func TestRun(t *testing.T) {
85
-	docker, err := newTestDocker()
85
+	runtime, err := newTestRuntime()
86 86
 	if err != nil {
87 87
 		t.Fatal(err)
88 88
 	}
89
-	defer nuke(docker)
90
-	container, err := docker.Create(
89
+	defer nuke(runtime)
90
+	container, err := runtime.Create(
91 91
 		"ls",
92 92
 		[]string{"-al"},
93
-		GetTestImage(docker).Id,
93
+		GetTestImage(runtime).Id,
94 94
 		&Config{
95 95
 			Memory: 33554432,
96 96
 		},
... ...
@@ -98,7 +98,7 @@ func TestRun(t *testing.T) {
98 98
 	if err != nil {
99 99
 		t.Fatal(err)
100 100
 	}
101
-	defer docker.Destroy(container)
101
+	defer runtime.Destroy(container)
102 102
 
103 103
 	if container.State.Running {
104 104
 		t.Errorf("Container shouldn't be running")
... ...
@@ -112,21 +112,21 @@ func TestRun(t *testing.T) {
112 112
 }
113 113
 
114 114
 func TestOutput(t *testing.T) {
115
-	docker, err := newTestDocker()
115
+	runtime, err := newTestRuntime()
116 116
 	if err != nil {
117 117
 		t.Fatal(err)
118 118
 	}
119
-	defer nuke(docker)
120
-	container, err := docker.Create(
119
+	defer nuke(runtime)
120
+	container, err := runtime.Create(
121 121
 		"echo",
122 122
 		[]string{"-n", "foobar"},
123
-		GetTestImage(docker).Id,
123
+		GetTestImage(runtime).Id,
124 124
 		&Config{},
125 125
 	)
126 126
 	if err != nil {
127 127
 		t.Fatal(err)
128 128
 	}
129
-	defer docker.Destroy(container)
129
+	defer runtime.Destroy(container)
130 130
 	output, err := container.Output()
131 131
 	if err != nil {
132 132
 		t.Fatal(err)
... ...
@@ -137,21 +137,21 @@ func TestOutput(t *testing.T) {
137 137
 }
138 138
 
139 139
 func TestKill(t *testing.T) {
140
-	docker, err := newTestDocker()
140
+	runtime, err := newTestRuntime()
141 141
 	if err != nil {
142 142
 		t.Fatal(err)
143 143
 	}
144
-	defer nuke(docker)
145
-	container, err := docker.Create(
144
+	defer nuke(runtime)
145
+	container, err := runtime.Create(
146 146
 		"cat",
147 147
 		[]string{"/dev/zero"},
148
-		GetTestImage(docker).Id,
148
+		GetTestImage(runtime).Id,
149 149
 		&Config{},
150 150
 	)
151 151
 	if err != nil {
152 152
 		t.Fatal(err)
153 153
 	}
154
-	defer docker.Destroy(container)
154
+	defer runtime.Destroy(container)
155 155
 
156 156
 	if container.State.Running {
157 157
 		t.Errorf("Container shouldn't be running")
... ...
@@ -179,36 +179,36 @@ func TestKill(t *testing.T) {
179 179
 }
180 180
 
181 181
 func TestExitCode(t *testing.T) {
182
-	docker, err := newTestDocker()
182
+	runtime, err := newTestRuntime()
183 183
 	if err != nil {
184 184
 		t.Fatal(err)
185 185
 	}
186
-	defer nuke(docker)
186
+	defer nuke(runtime)
187 187
 
188
-	trueContainer, err := docker.Create(
188
+	trueContainer, err := runtime.Create(
189 189
 		"/bin/true",
190 190
 		[]string{""},
191
-		GetTestImage(docker).Id,
191
+		GetTestImage(runtime).Id,
192 192
 		&Config{},
193 193
 	)
194 194
 	if err != nil {
195 195
 		t.Fatal(err)
196 196
 	}
197
-	defer docker.Destroy(trueContainer)
197
+	defer runtime.Destroy(trueContainer)
198 198
 	if err := trueContainer.Run(); err != nil {
199 199
 		t.Fatal(err)
200 200
 	}
201 201
 
202
-	falseContainer, err := docker.Create(
202
+	falseContainer, err := runtime.Create(
203 203
 		"/bin/false",
204 204
 		[]string{""},
205
-		GetTestImage(docker).Id,
205
+		GetTestImage(runtime).Id,
206 206
 		&Config{},
207 207
 	)
208 208
 	if err != nil {
209 209
 		t.Fatal(err)
210 210
 	}
211
-	defer docker.Destroy(falseContainer)
211
+	defer runtime.Destroy(falseContainer)
212 212
 	if err := falseContainer.Run(); err != nil {
213 213
 		t.Fatal(err)
214 214
 	}
... ...
@@ -223,21 +223,21 @@ func TestExitCode(t *testing.T) {
223 223
 }
224 224
 
225 225
 func TestRestart(t *testing.T) {
226
-	docker, err := newTestDocker()
226
+	runtime, err := newTestRuntime()
227 227
 	if err != nil {
228 228
 		t.Fatal(err)
229 229
 	}
230
-	defer nuke(docker)
231
-	container, err := docker.Create(
230
+	defer nuke(runtime)
231
+	container, err := runtime.Create(
232 232
 		"echo",
233 233
 		[]string{"-n", "foobar"},
234
-		GetTestImage(docker).Id,
234
+		GetTestImage(runtime).Id,
235 235
 		&Config{},
236 236
 	)
237 237
 	if err != nil {
238 238
 		t.Fatal(err)
239 239
 	}
240
-	defer docker.Destroy(container)
240
+	defer runtime.Destroy(container)
241 241
 	output, err := container.Output()
242 242
 	if err != nil {
243 243
 		t.Fatal(err)
... ...
@@ -257,15 +257,15 @@ func TestRestart(t *testing.T) {
257 257
 }
258 258
 
259 259
 func TestRestartStdin(t *testing.T) {
260
-	docker, err := newTestDocker()
260
+	runtime, err := newTestRuntime()
261 261
 	if err != nil {
262 262
 		t.Fatal(err)
263 263
 	}
264
-	defer nuke(docker)
265
-	container, err := docker.Create(
264
+	defer nuke(runtime)
265
+	container, err := runtime.Create(
266 266
 		"cat",
267 267
 		[]string{},
268
-		GetTestImage(docker).Id,
268
+		GetTestImage(runtime).Id,
269 269
 		&Config{
270 270
 			OpenStdin: true,
271 271
 		},
... ...
@@ -273,7 +273,7 @@ func TestRestartStdin(t *testing.T) {
273 273
 	if err != nil {
274 274
 		t.Fatal(err)
275 275
 	}
276
-	defer docker.Destroy(container)
276
+	defer runtime.Destroy(container)
277 277
 
278 278
 	stdin, err := container.StdinPipe()
279 279
 	stdout, err := container.StdoutPipe()
... ...
@@ -306,23 +306,23 @@ func TestRestartStdin(t *testing.T) {
306 306
 }
307 307
 
308 308
 func TestUser(t *testing.T) {
309
-	docker, err := newTestDocker()
309
+	runtime, err := newTestRuntime()
310 310
 	if err != nil {
311 311
 		t.Fatal(err)
312 312
 	}
313
-	defer nuke(docker)
313
+	defer nuke(runtime)
314 314
 
315 315
 	// Default user must be root
316
-	container, err := docker.Create(
316
+	container, err := runtime.Create(
317 317
 		"id",
318 318
 		[]string{},
319
-		GetTestImage(docker).Id,
319
+		GetTestImage(runtime).Id,
320 320
 		&Config{},
321 321
 	)
322 322
 	if err != nil {
323 323
 		t.Fatal(err)
324 324
 	}
325
-	defer docker.Destroy(container)
325
+	defer runtime.Destroy(container)
326 326
 	output, err := container.Output()
327 327
 	if err != nil {
328 328
 		t.Fatal(err)
... ...
@@ -332,10 +332,10 @@ func TestUser(t *testing.T) {
332 332
 	}
333 333
 
334 334
 	// Set a username
335
-	container, err = docker.Create(
335
+	container, err = runtime.Create(
336 336
 		"id",
337 337
 		[]string{},
338
-		GetTestImage(docker).Id,
338
+		GetTestImage(runtime).Id,
339 339
 		&Config{
340 340
 			User: "root",
341 341
 		},
... ...
@@ -343,7 +343,7 @@ func TestUser(t *testing.T) {
343 343
 	if err != nil {
344 344
 		t.Fatal(err)
345 345
 	}
346
-	defer docker.Destroy(container)
346
+	defer runtime.Destroy(container)
347 347
 	output, err = container.Output()
348 348
 	if err != nil || container.State.ExitCode != 0 {
349 349
 		t.Fatal(err)
... ...
@@ -353,10 +353,10 @@ func TestUser(t *testing.T) {
353 353
 	}
354 354
 
355 355
 	// Set a UID
356
-	container, err = docker.Create(
356
+	container, err = runtime.Create(
357 357
 		"id",
358 358
 		[]string{},
359
-		GetTestImage(docker).Id,
359
+		GetTestImage(runtime).Id,
360 360
 		&Config{
361 361
 			User: "0",
362 362
 		},
... ...
@@ -364,7 +364,7 @@ func TestUser(t *testing.T) {
364 364
 	if err != nil || container.State.ExitCode != 0 {
365 365
 		t.Fatal(err)
366 366
 	}
367
-	defer docker.Destroy(container)
367
+	defer runtime.Destroy(container)
368 368
 	output, err = container.Output()
369 369
 	if err != nil || container.State.ExitCode != 0 {
370 370
 		t.Fatal(err)
... ...
@@ -374,10 +374,10 @@ func TestUser(t *testing.T) {
374 374
 	}
375 375
 
376 376
 	// Set a different user by uid
377
-	container, err = docker.Create(
377
+	container, err = runtime.Create(
378 378
 		"id",
379 379
 		[]string{},
380
-		GetTestImage(docker).Id,
380
+		GetTestImage(runtime).Id,
381 381
 		&Config{
382 382
 			User: "1",
383 383
 		},
... ...
@@ -385,7 +385,7 @@ func TestUser(t *testing.T) {
385 385
 	if err != nil {
386 386
 		t.Fatal(err)
387 387
 	}
388
-	defer docker.Destroy(container)
388
+	defer runtime.Destroy(container)
389 389
 	output, err = container.Output()
390 390
 	if err != nil {
391 391
 		t.Fatal(err)
... ...
@@ -397,10 +397,10 @@ func TestUser(t *testing.T) {
397 397
 	}
398 398
 
399 399
 	// Set a different user by username
400
-	container, err = docker.Create(
400
+	container, err = runtime.Create(
401 401
 		"id",
402 402
 		[]string{},
403
-		GetTestImage(docker).Id,
403
+		GetTestImage(runtime).Id,
404 404
 		&Config{
405 405
 			User: "daemon",
406 406
 		},
... ...
@@ -408,7 +408,7 @@ func TestUser(t *testing.T) {
408 408
 	if err != nil {
409 409
 		t.Fatal(err)
410 410
 	}
411
-	defer docker.Destroy(container)
411
+	defer runtime.Destroy(container)
412 412
 	output, err = container.Output()
413 413
 	if err != nil || container.State.ExitCode != 0 {
414 414
 		t.Fatal(err)
... ...
@@ -419,33 +419,33 @@ func TestUser(t *testing.T) {
419 419
 }
420 420
 
421 421
 func TestMultipleContainers(t *testing.T) {
422
-	docker, err := newTestDocker()
422
+	runtime, err := newTestRuntime()
423 423
 	if err != nil {
424 424
 		t.Fatal(err)
425 425
 	}
426
-	defer nuke(docker)
426
+	defer nuke(runtime)
427 427
 
428
-	container1, err := docker.Create(
428
+	container1, err := runtime.Create(
429 429
 		"cat",
430 430
 		[]string{"/dev/zero"},
431
-		GetTestImage(docker).Id,
431
+		GetTestImage(runtime).Id,
432 432
 		&Config{},
433 433
 	)
434 434
 	if err != nil {
435 435
 		t.Fatal(err)
436 436
 	}
437
-	defer docker.Destroy(container1)
437
+	defer runtime.Destroy(container1)
438 438
 
439
-	container2, err := docker.Create(
439
+	container2, err := runtime.Create(
440 440
 		"cat",
441 441
 		[]string{"/dev/zero"},
442
-		GetTestImage(docker).Id,
442
+		GetTestImage(runtime).Id,
443 443
 		&Config{},
444 444
 	)
445 445
 	if err != nil {
446 446
 		t.Fatal(err)
447 447
 	}
448
-	defer docker.Destroy(container2)
448
+	defer runtime.Destroy(container2)
449 449
 
450 450
 	// Start both containers
451 451
 	if err := container1.Start(); err != nil {
... ...
@@ -474,15 +474,15 @@ func TestMultipleContainers(t *testing.T) {
474 474
 }
475 475
 
476 476
 func TestStdin(t *testing.T) {
477
-	docker, err := newTestDocker()
477
+	runtime, err := newTestRuntime()
478 478
 	if err != nil {
479 479
 		t.Fatal(err)
480 480
 	}
481
-	defer nuke(docker)
482
-	container, err := docker.Create(
481
+	defer nuke(runtime)
482
+	container, err := runtime.Create(
483 483
 		"cat",
484 484
 		[]string{},
485
-		GetTestImage(docker).Id,
485
+		GetTestImage(runtime).Id,
486 486
 		&Config{
487 487
 			OpenStdin: true,
488 488
 		},
... ...
@@ -490,7 +490,7 @@ func TestStdin(t *testing.T) {
490 490
 	if err != nil {
491 491
 		t.Fatal(err)
492 492
 	}
493
-	defer docker.Destroy(container)
493
+	defer runtime.Destroy(container)
494 494
 
495 495
 	stdin, err := container.StdinPipe()
496 496
 	stdout, err := container.StdoutPipe()
... ...
@@ -509,15 +509,15 @@ func TestStdin(t *testing.T) {
509 509
 }
510 510
 
511 511
 func TestTty(t *testing.T) {
512
-	docker, err := newTestDocker()
512
+	runtime, err := newTestRuntime()
513 513
 	if err != nil {
514 514
 		t.Fatal(err)
515 515
 	}
516
-	defer nuke(docker)
517
-	container, err := docker.Create(
516
+	defer nuke(runtime)
517
+	container, err := runtime.Create(
518 518
 		"cat",
519 519
 		[]string{},
520
-		GetTestImage(docker).Id,
520
+		GetTestImage(runtime).Id,
521 521
 		&Config{
522 522
 			OpenStdin: true,
523 523
 		},
... ...
@@ -525,7 +525,7 @@ func TestTty(t *testing.T) {
525 525
 	if err != nil {
526 526
 		t.Fatal(err)
527 527
 	}
528
-	defer docker.Destroy(container)
528
+	defer runtime.Destroy(container)
529 529
 
530 530
 	stdin, err := container.StdinPipe()
531 531
 	stdout, err := container.StdoutPipe()
... ...
@@ -544,21 +544,21 @@ func TestTty(t *testing.T) {
544 544
 }
545 545
 
546 546
 func TestEnv(t *testing.T) {
547
-	docker, err := newTestDocker()
547
+	runtime, err := newTestRuntime()
548 548
 	if err != nil {
549 549
 		t.Fatal(err)
550 550
 	}
551
-	defer nuke(docker)
552
-	container, err := docker.Create(
551
+	defer nuke(runtime)
552
+	container, err := runtime.Create(
553 553
 		"/usr/bin/env",
554 554
 		[]string{},
555
-		GetTestImage(docker).Id,
555
+		GetTestImage(runtime).Id,
556 556
 		&Config{},
557 557
 	)
558 558
 	if err != nil {
559 559
 		t.Fatal(err)
560 560
 	}
561
-	defer docker.Destroy(container)
561
+	defer runtime.Destroy(container)
562 562
 	stdout, err := container.StdoutPipe()
563 563
 	if err != nil {
564 564
 		t.Fatal(err)
... ...
@@ -613,20 +613,20 @@ func grepFile(t *testing.T, path string, pattern string) {
613 613
 }
614 614
 
615 615
 func TestLXCConfig(t *testing.T) {
616
-	docker, err := newTestDocker()
616
+	runtime, err := newTestRuntime()
617 617
 	if err != nil {
618 618
 		t.Fatal(err)
619 619
 	}
620
-	defer nuke(docker)
620
+	defer nuke(runtime)
621 621
 	// Memory is allocated randomly for testing
622 622
 	rand.Seed(time.Now().UTC().UnixNano())
623 623
 	memMin := 33554432
624 624
 	memMax := 536870912
625 625
 	mem := memMin + rand.Intn(memMax-memMin)
626
-	container, err := docker.Create(
626
+	container, err := runtime.Create(
627 627
 		"/bin/true",
628 628
 		[]string{},
629
-		GetTestImage(docker).Id,
629
+		GetTestImage(runtime).Id,
630 630
 		&Config{
631 631
 			Hostname: "foobar",
632 632
 			Memory:   int64(mem),
... ...
@@ -635,7 +635,7 @@ func TestLXCConfig(t *testing.T) {
635 635
 	if err != nil {
636 636
 		t.Fatal(err)
637 637
 	}
638
-	defer docker.Destroy(container)
638
+	defer runtime.Destroy(container)
639 639
 	container.generateLXCConfig()
640 640
 	grepFile(t, container.lxcConfigPath(), "lxc.utsname = foobar")
641 641
 	grepFile(t, container.lxcConfigPath(),
... ...
@@ -645,22 +645,22 @@ func TestLXCConfig(t *testing.T) {
645 645
 }
646 646
 
647 647
 func BenchmarkRunSequencial(b *testing.B) {
648
-	docker, err := newTestDocker()
648
+	runtime, err := newTestRuntime()
649 649
 	if err != nil {
650 650
 		b.Fatal(err)
651 651
 	}
652
-	defer nuke(docker)
652
+	defer nuke(runtime)
653 653
 	for i := 0; i < b.N; i++ {
654
-		container, err := docker.Create(
654
+		container, err := runtime.Create(
655 655
 			"echo",
656 656
 			[]string{"-n", "foo"},
657
-			GetTestImage(docker).Id,
657
+			GetTestImage(runtime).Id,
658 658
 			&Config{},
659 659
 		)
660 660
 		if err != nil {
661 661
 			b.Fatal(err)
662 662
 		}
663
-		defer docker.Destroy(container)
663
+		defer runtime.Destroy(container)
664 664
 		output, err := container.Output()
665 665
 		if err != nil {
666 666
 			b.Fatal(err)
... ...
@@ -668,18 +668,18 @@ func BenchmarkRunSequencial(b *testing.B) {
668 668
 		if string(output) != "foo" {
669 669
 			b.Fatalf("Unexecpted output: %v", string(output))
670 670
 		}
671
-		if err := docker.Destroy(container); err != nil {
671
+		if err := runtime.Destroy(container); err != nil {
672 672
 			b.Fatal(err)
673 673
 		}
674 674
 	}
675 675
 }
676 676
 
677 677
 func BenchmarkRunParallel(b *testing.B) {
678
-	docker, err := newTestDocker()
678
+	runtime, err := newTestRuntime()
679 679
 	if err != nil {
680 680
 		b.Fatal(err)
681 681
 	}
682
-	defer nuke(docker)
682
+	defer nuke(runtime)
683 683
 
684 684
 	var tasks []chan error
685 685
 
... ...
@@ -687,17 +687,17 @@ func BenchmarkRunParallel(b *testing.B) {
687 687
 		complete := make(chan error)
688 688
 		tasks = append(tasks, complete)
689 689
 		go func(i int, complete chan error) {
690
-			container, err := docker.Create(
690
+			container, err := runtime.Create(
691 691
 				"echo",
692 692
 				[]string{"-n", "foo"},
693
-				GetTestImage(docker).Id,
693
+				GetTestImage(runtime).Id,
694 694
 				&Config{},
695 695
 			)
696 696
 			if err != nil {
697 697
 				complete <- err
698 698
 				return
699 699
 			}
700
-			defer docker.Destroy(container)
700
+			defer runtime.Destroy(container)
701 701
 			if err := container.Start(); err != nil {
702 702
 				complete <- err
703 703
 				return
... ...
@@ -709,7 +709,7 @@ func BenchmarkRunParallel(b *testing.B) {
709 709
 			// if string(output) != "foo" {
710 710
 			// 	complete <- fmt.Errorf("Unexecpted output: %v", string(output))
711 711
 			// }
712
-			if err := docker.Destroy(container); err != nil {
712
+			if err := runtime.Destroy(container); err != nil {
713 713
 				complete <- err
714 714
 				return
715 715
 			}
... ...
@@ -14,7 +14,7 @@ import (
14 14
 	"time"
15 15
 )
16 16
 
17
-type Docker struct {
17
+type Runtime struct {
18 18
 	root           string
19 19
 	repository     string
20 20
 	containers     *list.List
... ...
@@ -28,16 +28,16 @@ func init() {
28 28
 	sysInitPath = SelfPath()
29 29
 }
30 30
 
31
-func (docker *Docker) List() []*Container {
31
+func (runtime *Runtime) List() []*Container {
32 32
 	containers := new(History)
33
-	for e := docker.containers.Front(); e != nil; e = e.Next() {
33
+	for e := runtime.containers.Front(); e != nil; e = e.Next() {
34 34
 		containers.Add(e.Value.(*Container))
35 35
 	}
36 36
 	return *containers
37 37
 }
38 38
 
39
-func (docker *Docker) getContainerElement(id string) *list.Element {
40
-	for e := docker.containers.Front(); e != nil; e = e.Next() {
39
+func (runtime *Runtime) getContainerElement(id string) *list.Element {
40
+	for e := runtime.containers.Front(); e != nil; e = e.Next() {
41 41
 		container := e.Value.(*Container)
42 42
 		if container.Id == id {
43 43
 			return e
... ...
@@ -46,23 +46,23 @@ func (docker *Docker) getContainerElement(id string) *list.Element {
46 46
 	return nil
47 47
 }
48 48
 
49
-func (docker *Docker) Get(id string) *Container {
50
-	e := docker.getContainerElement(id)
49
+func (runtime *Runtime) Get(id string) *Container {
50
+	e := runtime.getContainerElement(id)
51 51
 	if e == nil {
52 52
 		return nil
53 53
 	}
54 54
 	return e.Value.(*Container)
55 55
 }
56 56
 
57
-func (docker *Docker) Exists(id string) bool {
58
-	return docker.Get(id) != nil
57
+func (runtime *Runtime) Exists(id string) bool {
58
+	return runtime.Get(id) != nil
59 59
 }
60 60
 
61
-func (docker *Docker) containerRoot(id string) string {
62
-	return path.Join(docker.repository, id)
61
+func (runtime *Runtime) containerRoot(id string) string {
62
+	return path.Join(runtime.repository, id)
63 63
 }
64 64
 
65
-func (docker *Docker) Create(command string, args []string, image string, config *Config) (*Container, error) {
65
+func (runtime *Runtime) Create(command string, args []string, image string, config *Config) (*Container, error) {
66 66
 	container := &Container{
67 67
 		// FIXME: we should generate the ID here instead of receiving it as an argument
68 68
 		Id:              GenerateId(),
... ...
@@ -75,7 +75,7 @@ func (docker *Docker) Create(command string, args []string, image string, config
75 75
 		// FIXME: do we need to store this in the container?
76 76
 		SysInitPath: sysInitPath,
77 77
 	}
78
-	container.root = docker.containerRoot(container.Id)
78
+	container.root = runtime.containerRoot(container.Id)
79 79
 	// Step 1: create the container directory.
80 80
 	// This doubles as a barrier to avoid race conditions.
81 81
 	if err := os.Mkdir(container.root, 0700); err != nil {
... ...
@@ -86,36 +86,36 @@ func (docker *Docker) Create(command string, args []string, image string, config
86 86
 		return nil, err
87 87
 	}
88 88
 	// Step 3: register the container
89
-	if err := docker.Register(container); err != nil {
89
+	if err := runtime.Register(container); err != nil {
90 90
 		return nil, err
91 91
 	}
92 92
 	return container, nil
93 93
 }
94 94
 
95
-func (docker *Docker) Load(id string) (*Container, error) {
96
-	container := &Container{root: docker.containerRoot(id)}
95
+func (runtime *Runtime) Load(id string) (*Container, error) {
96
+	container := &Container{root: runtime.containerRoot(id)}
97 97
 	if err := container.FromDisk(); err != nil {
98 98
 		return nil, err
99 99
 	}
100 100
 	if container.Id != id {
101 101
 		return container, fmt.Errorf("Container %s is stored at %s", container.Id, id)
102 102
 	}
103
-	if err := docker.Register(container); err != nil {
103
+	if err := runtime.Register(container); err != nil {
104 104
 		return nil, err
105 105
 	}
106 106
 	return container, nil
107 107
 }
108 108
 
109 109
 // Register makes a container object usable by the runtime as <container.Id>
110
-func (docker *Docker) Register(container *Container) error {
111
-	if container.runtime != nil || docker.Exists(container.Id) {
110
+func (runtime *Runtime) Register(container *Container) error {
111
+	if container.runtime != nil || runtime.Exists(container.Id) {
112 112
 		return fmt.Errorf("Container is already loaded")
113 113
 	}
114 114
 	if err := validateId(container.Id); err != nil {
115 115
 		return err
116 116
 	}
117
-	container.runtime = docker
118
-	container.networkManager = docker.networkManager // FIXME: infer from docker.runtime
117
+	container.runtime = runtime
118
+	container.networkManager = runtime.networkManager // FIXME: infer from docker.runtime
119 119
 	// Setup state lock (formerly in newState()
120 120
 	lock := new(sync.Mutex)
121 121
 	container.State.stateChangeLock = lock
... ...
@@ -130,18 +130,18 @@ func (docker *Docker) Register(container *Container) error {
130 130
 		container.stdinPipe = NopWriteCloser(ioutil.Discard) // Silently drop stdin
131 131
 	}
132 132
 	// Setup logging of stdout and stderr to disk
133
-	if err := docker.LogToDisk(container.stdout, container.logPath("stdout")); err != nil {
133
+	if err := runtime.LogToDisk(container.stdout, container.logPath("stdout")); err != nil {
134 134
 		return err
135 135
 	}
136
-	if err := docker.LogToDisk(container.stderr, container.logPath("stderr")); err != nil {
136
+	if err := runtime.LogToDisk(container.stderr, container.logPath("stderr")); err != nil {
137 137
 		return err
138 138
 	}
139 139
 	// done
140
-	docker.containers.PushBack(container)
140
+	runtime.containers.PushBack(container)
141 141
 	return nil
142 142
 }
143 143
 
144
-func (docker *Docker) LogToDisk(src *writeBroadcaster, dst string) error {
144
+func (runtime *Runtime) LogToDisk(src *writeBroadcaster, dst string) error {
145 145
 	log, err := os.OpenFile(dst, os.O_RDWR|os.O_APPEND|os.O_CREATE, 0600)
146 146
 	if err != nil {
147 147
 		return err
... ...
@@ -150,8 +150,8 @@ func (docker *Docker) LogToDisk(src *writeBroadcaster, dst string) error {
150 150
 	return nil
151 151
 }
152 152
 
153
-func (docker *Docker) Destroy(container *Container) error {
154
-	element := docker.getContainerElement(container.Id)
153
+func (runtime *Runtime) Destroy(container *Container) error {
154
+	element := runtime.getContainerElement(container.Id)
155 155
 	if element == nil {
156 156
 		return fmt.Errorf("Container %v not found - maybe it was already destroyed?", container.Id)
157 157
 	}
... ...
@@ -167,21 +167,21 @@ func (docker *Docker) Destroy(container *Container) error {
167 167
 		}
168 168
 	}
169 169
 	// Deregister the container before removing its directory, to avoid race conditions
170
-	docker.containers.Remove(element)
170
+	runtime.containers.Remove(element)
171 171
 	if err := os.RemoveAll(container.root); err != nil {
172 172
 		return fmt.Errorf("Unable to remove filesystem for %v: %v", container.Id, err)
173 173
 	}
174 174
 	return nil
175 175
 }
176 176
 
177
-func (docker *Docker) restore() error {
178
-	dir, err := ioutil.ReadDir(docker.repository)
177
+func (runtime *Runtime) restore() error {
178
+	dir, err := ioutil.ReadDir(runtime.repository)
179 179
 	if err != nil {
180 180
 		return err
181 181
 	}
182 182
 	for _, v := range dir {
183 183
 		id := v.Name()
184
-		container, err := docker.Load(id)
184
+		container, err := runtime.Load(id)
185 185
 		if err != nil {
186 186
 			log.Printf("Failed to load container %v: %v", id, err)
187 187
 			continue
... ...
@@ -191,14 +191,14 @@ func (docker *Docker) restore() error {
191 191
 	return nil
192 192
 }
193 193
 
194
-func New() (*Docker, error) {
194
+func New() (*Runtime, error) {
195 195
 	return NewFromDirectory("/var/lib/docker")
196 196
 }
197 197
 
198
-func NewFromDirectory(root string) (*Docker, error) {
199
-	docker_repo := path.Join(root, "containers")
198
+func NewFromDirectory(root string) (*Runtime, error) {
199
+	runtime_repo := path.Join(root, "containers")
200 200
 
201
-	if err := os.MkdirAll(docker_repo, 0700); err != nil && !os.IsExist(err) {
201
+	if err := os.MkdirAll(runtime_repo, 0700); err != nil && !os.IsExist(err) {
202 202
 		return nil, err
203 203
 	}
204 204
 
... ...
@@ -211,18 +211,18 @@ func NewFromDirectory(root string) (*Docker, error) {
211 211
 		return nil, err
212 212
 	}
213 213
 
214
-	docker := &Docker{
214
+	runtime := &Runtime{
215 215
 		root:           root,
216
-		repository:     docker_repo,
216
+		repository:     runtime_repo,
217 217
 		containers:     list.New(),
218 218
 		networkManager: netManager,
219 219
 		graph:          graph,
220 220
 	}
221 221
 
222
-	if err := docker.restore(); err != nil {
222
+	if err := runtime.restore(); err != nil {
223 223
 		return nil, err
224 224
 	}
225
-	return docker, nil
225
+	return runtime, nil
226 226
 }
227 227
 
228 228
 type History []*Container
... ...
@@ -16,8 +16,8 @@ const unitTestImageName string = "busybox"
16 16
 var unitTestStoreBase string
17 17
 var srv *Server
18 18
 
19
-func nuke(docker *Docker) error {
20
-	return os.RemoveAll(docker.root)
19
+func nuke(runtime *Runtime) error {
20
+	return os.RemoveAll(runtime.root)
21 21
 }
22 22
 
23 23
 func CopyDirectory(source, dest string) error {
... ...
@@ -57,13 +57,13 @@ func init() {
57 57
 	unitTestStoreBase = root
58 58
 
59 59
 	// Make it our Store root
60
-	docker, err := NewFromDirectory(root)
60
+	runtime, err := NewFromDirectory(root)
61 61
 	if err != nil {
62 62
 		panic(err)
63 63
 	}
64 64
 	// Create the "Server"
65 65
 	srv := &Server{
66
-		containers: docker,
66
+		runtime: runtime,
67 67
 	}
68 68
 	// Retrieve the Image
69 69
 	if err := srv.CmdImport(os.Stdin, os.Stdout, unitTestImageName); err != nil {
... ...
@@ -71,7 +71,7 @@ func init() {
71 71
 	}
72 72
 }
73 73
 
74
-func newTestDocker() (*Docker, error) {
74
+func newTestRuntime() (*Runtime, error) {
75 75
 	root, err := ioutil.TempDir("", "docker-test")
76 76
 	if err != nil {
77 77
 		return nil, err
... ...
@@ -84,16 +84,16 @@ func newTestDocker() (*Docker, error) {
84 84
 		return nil, err
85 85
 	}
86 86
 
87
-	docker, err := NewFromDirectory(root)
87
+	runtime, err := NewFromDirectory(root)
88 88
 	if err != nil {
89 89
 		return nil, err
90 90
 	}
91 91
 
92
-	return docker, nil
92
+	return runtime, nil
93 93
 }
94 94
 
95
-func GetTestImage(docker *Docker) *graph.Image {
96
-	imgs, err := docker.graph.All()
95
+func GetTestImage(runtime *Runtime) *graph.Image {
96
+	imgs, err := runtime.graph.All()
97 97
 	if err != nil {
98 98
 		panic(err)
99 99
 	} else if len(imgs) < 1 {
... ...
@@ -103,20 +103,20 @@ func GetTestImage(docker *Docker) *graph.Image {
103 103
 }
104 104
 
105 105
 func TestCreate(t *testing.T) {
106
-	docker, err := newTestDocker()
106
+	runtime, err := newTestRuntime()
107 107
 	if err != nil {
108 108
 		t.Fatal(err)
109 109
 	}
110
-	defer nuke(docker)
110
+	defer nuke(runtime)
111 111
 
112 112
 	// Make sure we start we 0 containers
113
-	if len(docker.List()) != 0 {
114
-		t.Errorf("Expected 0 containers, %v found", len(docker.List()))
113
+	if len(runtime.List()) != 0 {
114
+		t.Errorf("Expected 0 containers, %v found", len(runtime.List()))
115 115
 	}
116
-	container, err := docker.Create(
116
+	container, err := runtime.Create(
117 117
 		"ls",
118 118
 		[]string{"-al"},
119
-		GetTestImage(docker).Id,
119
+		GetTestImage(runtime).Id,
120 120
 		&Config{},
121 121
 	)
122 122
 	if err != nil {
... ...
@@ -124,69 +124,69 @@ func TestCreate(t *testing.T) {
124 124
 	}
125 125
 
126 126
 	defer func() {
127
-		if err := docker.Destroy(container); err != nil {
127
+		if err := runtime.Destroy(container); err != nil {
128 128
 			t.Error(err)
129 129
 		}
130 130
 	}()
131 131
 
132 132
 	// Make sure we can find the newly created container with List()
133
-	if len(docker.List()) != 1 {
134
-		t.Errorf("Expected 1 container, %v found", len(docker.List()))
133
+	if len(runtime.List()) != 1 {
134
+		t.Errorf("Expected 1 container, %v found", len(runtime.List()))
135 135
 	}
136 136
 
137 137
 	// Make sure the container List() returns is the right one
138
-	if docker.List()[0].Id != container.Id {
139
-		t.Errorf("Unexpected container %v returned by List", docker.List()[0])
138
+	if runtime.List()[0].Id != container.Id {
139
+		t.Errorf("Unexpected container %v returned by List", runtime.List()[0])
140 140
 	}
141 141
 
142 142
 	// Make sure we can get the container with Get()
143
-	if docker.Get(container.Id) == nil {
143
+	if runtime.Get(container.Id) == nil {
144 144
 		t.Errorf("Unable to get newly created container")
145 145
 	}
146 146
 
147 147
 	// Make sure it is the right container
148
-	if docker.Get(container.Id) != container {
148
+	if runtime.Get(container.Id) != container {
149 149
 		t.Errorf("Get() returned the wrong container")
150 150
 	}
151 151
 
152 152
 	// Make sure Exists returns it as existing
153
-	if !docker.Exists(container.Id) {
153
+	if !runtime.Exists(container.Id) {
154 154
 		t.Errorf("Exists() returned false for a newly created container")
155 155
 	}
156 156
 }
157 157
 
158 158
 func TestDestroy(t *testing.T) {
159
-	docker, err := newTestDocker()
159
+	runtime, err := newTestRuntime()
160 160
 	if err != nil {
161 161
 		t.Fatal(err)
162 162
 	}
163
-	defer nuke(docker)
164
-	container, err := docker.Create(
163
+	defer nuke(runtime)
164
+	container, err := runtime.Create(
165 165
 		"ls",
166 166
 		[]string{"-al"},
167
-		GetTestImage(docker).Id,
167
+		GetTestImage(runtime).Id,
168 168
 		&Config{},
169 169
 	)
170 170
 	if err != nil {
171 171
 		t.Fatal(err)
172 172
 	}
173 173
 	// Destroy
174
-	if err := docker.Destroy(container); err != nil {
174
+	if err := runtime.Destroy(container); err != nil {
175 175
 		t.Error(err)
176 176
 	}
177 177
 
178
-	// Make sure docker.Exists() behaves correctly
179
-	if docker.Exists("test_destroy") {
178
+	// Make sure runtime.Exists() behaves correctly
179
+	if runtime.Exists("test_destroy") {
180 180
 		t.Errorf("Exists() returned true")
181 181
 	}
182 182
 
183
-	// Make sure docker.List() doesn't list the destroyed container
184
-	if len(docker.List()) != 0 {
185
-		t.Errorf("Expected 0 container, %v found", len(docker.List()))
183
+	// Make sure runtime.List() doesn't list the destroyed container
184
+	if len(runtime.List()) != 0 {
185
+		t.Errorf("Expected 0 container, %v found", len(runtime.List()))
186 186
 	}
187 187
 
188
-	// Make sure docker.Get() refuses to return the unexisting container
189
-	if docker.Get(container.Id) != nil {
188
+	// Make sure runtime.Get() refuses to return the unexisting container
189
+	if runtime.Get(container.Id) != nil {
190 190
 		t.Errorf("Unable to get newly created container")
191 191
 	}
192 192
 
... ...
@@ -197,61 +197,61 @@ func TestDestroy(t *testing.T) {
197 197
 	}
198 198
 
199 199
 	// Test double destroy
200
-	if err := docker.Destroy(container); err == nil {
200
+	if err := runtime.Destroy(container); err == nil {
201 201
 		// It should have failed
202 202
 		t.Errorf("Double destroy did not fail")
203 203
 	}
204 204
 }
205 205
 
206 206
 func TestGet(t *testing.T) {
207
-	docker, err := newTestDocker()
207
+	runtime, err := newTestRuntime()
208 208
 	if err != nil {
209 209
 		t.Fatal(err)
210 210
 	}
211
-	defer nuke(docker)
212
-	container1, err := docker.Create(
211
+	defer nuke(runtime)
212
+	container1, err := runtime.Create(
213 213
 		"ls",
214 214
 		[]string{"-al"},
215
-		GetTestImage(docker).Id,
215
+		GetTestImage(runtime).Id,
216 216
 		&Config{},
217 217
 	)
218 218
 	if err != nil {
219 219
 		t.Fatal(err)
220 220
 	}
221
-	defer docker.Destroy(container1)
221
+	defer runtime.Destroy(container1)
222 222
 
223
-	container2, err := docker.Create(
223
+	container2, err := runtime.Create(
224 224
 		"ls",
225 225
 		[]string{"-al"},
226
-		GetTestImage(docker).Id,
226
+		GetTestImage(runtime).Id,
227 227
 		&Config{},
228 228
 	)
229 229
 	if err != nil {
230 230
 		t.Fatal(err)
231 231
 	}
232
-	defer docker.Destroy(container2)
232
+	defer runtime.Destroy(container2)
233 233
 
234
-	container3, err := docker.Create(
234
+	container3, err := runtime.Create(
235 235
 		"ls",
236 236
 		[]string{"-al"},
237
-		GetTestImage(docker).Id,
237
+		GetTestImage(runtime).Id,
238 238
 		&Config{},
239 239
 	)
240 240
 	if err != nil {
241 241
 		t.Fatal(err)
242 242
 	}
243
-	defer docker.Destroy(container3)
243
+	defer runtime.Destroy(container3)
244 244
 
245
-	if docker.Get(container1.Id) != container1 {
246
-		t.Errorf("Get(test1) returned %v while expecting %v", docker.Get(container1.Id), container1)
245
+	if runtime.Get(container1.Id) != container1 {
246
+		t.Errorf("Get(test1) returned %v while expecting %v", runtime.Get(container1.Id), container1)
247 247
 	}
248 248
 
249
-	if docker.Get(container2.Id) != container2 {
250
-		t.Errorf("Get(test2) returned %v while expecting %v", docker.Get(container2.Id), container2)
249
+	if runtime.Get(container2.Id) != container2 {
250
+		t.Errorf("Get(test2) returned %v while expecting %v", runtime.Get(container2.Id), container2)
251 251
 	}
252 252
 
253
-	if docker.Get(container3.Id) != container3 {
254
-		t.Errorf("Get(test3) returned %v while expecting %v", docker.Get(container3.Id), container3)
253
+	if runtime.Get(container3.Id) != container3 {
254
+		t.Errorf("Get(test3) returned %v while expecting %v", runtime.Get(container3.Id), container3)
255 255
 	}
256 256
 
257 257
 }
... ...
@@ -269,24 +269,24 @@ func TestRestore(t *testing.T) {
269 269
 		t.Fatal(err)
270 270
 	}
271 271
 
272
-	docker1, err := NewFromDirectory(root)
272
+	runtime1, err := NewFromDirectory(root)
273 273
 	if err != nil {
274 274
 		t.Fatal(err)
275 275
 	}
276 276
 
277 277
 	// Create a container with one instance of docker
278
-	container1, err := docker1.Create(
278
+	container1, err := runtime1.Create(
279 279
 		"ls",
280 280
 		[]string{"-al"},
281
-		GetTestImage(docker1).Id,
281
+		GetTestImage(runtime1).Id,
282 282
 		&Config{},
283 283
 	)
284 284
 	if err != nil {
285 285
 		t.Fatal(err)
286 286
 	}
287
-	defer docker1.Destroy(container1)
288
-	if len(docker1.List()) != 1 {
289
-		t.Errorf("Expected 1 container, %v found", len(docker1.List()))
287
+	defer runtime1.Destroy(container1)
288
+	if len(runtime1.List()) != 1 {
289
+		t.Errorf("Expected 1 container, %v found", len(runtime1.List()))
290 290
 	}
291 291
 	if err := container1.Run(); err != nil {
292 292
 		t.Fatal(err)
... ...
@@ -294,15 +294,15 @@ func TestRestore(t *testing.T) {
294 294
 
295 295
 	// Here are are simulating a docker restart - that is, reloading all containers
296 296
 	// from scratch
297
-	docker2, err := NewFromDirectory(root)
297
+	runtime2, err := NewFromDirectory(root)
298 298
 	if err != nil {
299 299
 		t.Fatal(err)
300 300
 	}
301
-	defer nuke(docker2)
302
-	if len(docker2.List()) != 1 {
303
-		t.Errorf("Expected 1 container, %v found", len(docker2.List()))
301
+	defer nuke(runtime2)
302
+	if len(runtime2.List()) != 1 {
303
+		t.Errorf("Expected 1 container, %v found", len(runtime2.List()))
304 304
 	}
305
-	container2 := docker2.Get(container1.Id)
305
+	container2 := runtime2.Get(container1.Id)
306 306
 	if container2 == nil {
307 307
 		t.Fatal("Unable to Get container")
308 308
 	}