... | ... |
@@ -250,12 +250,12 @@ func getContainersChanges(srv *Server, version float64, w http.ResponseWriter, r |
250 | 250 |
return nil |
251 | 251 |
} |
252 | 252 |
|
253 |
-func getContainersProc(srv *Server, version float64, w http.ResponseWriter, r *http.Request, vars map[string]string) error { |
|
253 |
+func getContainersTop(srv *Server, version float64, w http.ResponseWriter, r *http.Request, vars map[string]string) error { |
|
254 | 254 |
if vars == nil { |
255 | 255 |
return fmt.Errorf("Missing parameter") |
256 | 256 |
} |
257 | 257 |
name := vars["name"] |
258 |
- procsStr, err := srv.ContainerProc(name) |
|
258 |
+ procsStr, err := srv.ContainerTop(name) |
|
259 | 259 |
if err != nil { |
260 | 260 |
return err |
261 | 261 |
} |
... | ... |
@@ -859,7 +859,7 @@ func createRouter(srv *Server, logging bool) (*mux.Router, error) { |
859 | 859 |
"/containers/{name:.*}/export": getContainersExport, |
860 | 860 |
"/containers/{name:.*}/changes": getContainersChanges, |
861 | 861 |
"/containers/{name:.*}/json": getContainersByName, |
862 |
- "/containers/{name:.*}/proc": getContainersProc, |
|
862 |
+ "/containers/{name:.*}/top": getContainersTop, |
|
863 | 863 |
}, |
864 | 864 |
"POST": { |
865 | 865 |
"/auth": postAuth, |
... | ... |
@@ -475,7 +475,7 @@ func TestGetContainersChanges(t *testing.T) { |
475 | 475 |
} |
476 | 476 |
} |
477 | 477 |
|
478 |
-func TestGetContainersProc(t *testing.T) { |
|
478 |
+func TestGetContainersTop(t *testing.T) { |
|
479 | 479 |
runtime, err := newTestRuntime() |
480 | 480 |
if err != nil { |
481 | 481 |
t.Fatal(err) |
... | ... |
@@ -509,10 +509,10 @@ func TestGetContainersProc(t *testing.T) { |
509 | 509 |
} |
510 | 510 |
|
511 | 511 |
r := httptest.NewRecorder() |
512 |
- if err := getContainersProc(srv, APIVERSION, r, nil, map[string]string{"name": container.ID}); err != nil { |
|
512 |
+ if err := getContainersTop(srv, APIVERSION, r, nil, map[string]string{"name": container.ID}); err != nil { |
|
513 | 513 |
t.Fatal(err) |
514 | 514 |
} |
515 |
- procs := []APIProc{} |
|
515 |
+ procs := []APITop{} |
|
516 | 516 |
if err := json.Unmarshal(r.Body.Bytes(), &procs); err != nil { |
517 | 517 |
t.Fatal(err) |
518 | 518 |
} |
... | ... |
@@ -90,7 +90,7 @@ func (cli *DockerCli) CmdHelp(args ...string) error { |
90 | 90 |
{"login", "Register or Login to the docker registry server"}, |
91 | 91 |
{"logs", "Fetch the logs of a container"}, |
92 | 92 |
{"port", "Lookup the public-facing port which is NAT-ed to PRIVATE_PORT"}, |
93 |
- {"proc", "Lookup the running processes of a container"}, |
|
93 |
+ {"top", "Lookup the running processes of a container"}, |
|
94 | 94 |
{"ps", "List containers"}, |
95 | 95 |
{"pull", "Pull an image or a repository from the docker registry server"}, |
96 | 96 |
{"push", "Push an image or a repository to the docker registry server"}, |
... | ... |
@@ -556,8 +556,8 @@ func (cli *DockerCli) CmdInspect(args ...string) error { |
556 | 556 |
return nil |
557 | 557 |
} |
558 | 558 |
|
559 |
-func (cli *DockerCli) CmdProc(args ...string) error { |
|
560 |
- cmd := Subcmd("proc", "CONTAINER", "Lookup the running processes of a container") |
|
559 |
+func (cli *DockerCli) CmdTop(args ...string) error { |
|
560 |
+ cmd := Subcmd("top", "CONTAINER", "Lookup the running processes of a container") |
|
561 | 561 |
if err := cmd.Parse(args); err != nil { |
562 | 562 |
return nil |
563 | 563 |
} |
... | ... |
@@ -565,11 +565,11 @@ func (cli *DockerCli) CmdProc(args ...string) error { |
565 | 565 |
cmd.Usage() |
566 | 566 |
return nil |
567 | 567 |
} |
568 |
- body, _, err := cli.call("GET", "/containers/"+cmd.Arg(0)+"/proc", nil) |
|
568 |
+ body, _, err := cli.call("GET", "/containers/"+cmd.Arg(0)+"/top", nil) |
|
569 | 569 |
if err != nil { |
570 | 570 |
return err |
571 | 571 |
} |
572 |
- var procs []APIProc |
|
572 |
+ var procs []APITop |
|
573 | 573 |
err = json.Unmarshal(body, &procs) |
574 | 574 |
if err != nil { |
575 | 575 |
return err |
... | ... |
@@ -223,7 +223,7 @@ Inspect a container |
223 | 223 |
List processes running inside a container |
224 | 224 |
***************************************** |
225 | 225 |
|
226 |
-.. http:get:: /containers/(id)/proc |
|
226 |
+.. http:get:: /containers/(id)/top |
|
227 | 227 |
|
228 | 228 |
List processes running inside the container ``id`` |
229 | 229 |
|
... | ... |
@@ -231,7 +231,7 @@ List processes running inside a container |
231 | 231 |
|
232 | 232 |
.. sourcecode:: http |
233 | 233 |
|
234 |
- GET /containers/4fa6e0f0c678/proc HTTP/1.1 |
|
234 |
+ GET /containers/4fa6e0f0c678/top HTTP/1.1 |
|
235 | 235 |
|
236 | 236 |
**Example response**: |
237 | 237 |
|
... | ... |
@@ -41,7 +41,6 @@ Available Commands |
41 | 41 |
command/login |
42 | 42 |
command/logs |
43 | 43 |
command/port |
44 |
- command/proc |
|
45 | 44 |
command/ps |
46 | 45 |
command/pull |
47 | 46 |
command/push |
... | ... |
@@ -53,5 +52,6 @@ Available Commands |
53 | 53 |
command/start |
54 | 54 |
command/stop |
55 | 55 |
command/tag |
56 |
+ command/top |
|
56 | 57 |
command/version |
57 | 58 |
command/wait |
58 | 59 |
deleted file mode 100644 |
... | ... |
@@ -1,13 +0,0 @@ |
1 |
-:title: Proc Command |
|
2 |
-:description: Lookup the running processes of a container |
|
3 |
-:keywords: proc, docker, container, documentation |
|
4 |
- |
|
5 |
-======================================================= |
|
6 |
-``proc`` -- Lookup the running processes of a container |
|
7 |
-======================================================= |
|
8 |
- |
|
9 |
-:: |
|
10 |
- |
|
11 |
- Usage: docker proc CONTAINER |
|
12 |
- |
|
13 |
- Lookup the running processes of a container |
14 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,13 @@ |
0 |
+:title: Top Command |
|
1 |
+:description: Lookup the running processes of a container |
|
2 |
+:keywords: top, docker, container, documentation |
|
3 |
+ |
|
4 |
+======================================================= |
|
5 |
+``top`` -- Lookup the running processes of a container |
|
6 |
+======================================================= |
|
7 |
+ |
|
8 |
+:: |
|
9 |
+ |
|
10 |
+ Usage: docker top CONTAINER |
|
11 |
+ |
|
12 |
+ Lookup the running processes of a container |
... | ... |
@@ -249,18 +249,18 @@ func (srv *Server) ImageHistory(name string) ([]APIHistory, error) { |
249 | 249 |
|
250 | 250 |
} |
251 | 251 |
|
252 |
-func (srv *Server) ContainerProc(name string) ([]APIProc, error) { |
|
252 |
+func (srv *Server) ContainerTop(name string) ([]APITop, error) { |
|
253 | 253 |
if container := srv.runtime.Get(name); container != nil { |
254 | 254 |
output, err := exec.Command("lxc-ps", "--name", container.ID).CombinedOutput() |
255 | 255 |
if err != nil { |
256 | 256 |
return nil, fmt.Errorf("Error trying to use lxc-ps: %s (%s)", err, output) |
257 | 257 |
} |
258 |
- var procs []APIProc |
|
258 |
+ var procs []APITop |
|
259 | 259 |
for i, line := range strings.Split(string(output), "\n") { |
260 | 260 |
if i == 0 || len(line) == 0 { |
261 | 261 |
continue |
262 | 262 |
} |
263 |
- proc := APIProc{} |
|
263 |
+ proc := APITop{} |
|
264 | 264 |
scanner := bufio.NewScanner(strings.NewReader(line)) |
265 | 265 |
scanner.Split(bufio.ScanWords) |
266 | 266 |
if !scanner.Scan() { |