| ... | ... |
@@ -3,7 +3,6 @@ package server |
| 3 | 3 |
import ( |
| 4 | 4 |
"bufio" |
| 5 | 5 |
"bytes" |
| 6 |
- "code.google.com/p/go.net/websocket" |
|
| 7 | 6 |
"crypto/tls" |
| 8 | 7 |
"crypto/x509" |
| 9 | 8 |
"encoding/base64" |
| ... | ... |
@@ -21,6 +20,8 @@ import ( |
| 21 | 21 |
"strings" |
| 22 | 22 |
"syscall" |
| 23 | 23 |
|
| 24 |
+ "code.google.com/p/go.net/websocket" |
|
| 25 |
+ |
|
| 24 | 26 |
"github.com/dotcloud/docker/api" |
| 25 | 27 |
"github.com/dotcloud/docker/engine" |
| 26 | 28 |
"github.com/dotcloud/docker/pkg/listenbuffer" |
| ... | ... |
@@ -976,6 +977,11 @@ func writeCorsHeaders(w http.ResponseWriter, r *http.Request) {
|
| 976 | 976 |
w.Header().Add("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT, OPTIONS")
|
| 977 | 977 |
} |
| 978 | 978 |
|
| 979 |
+func ping(eng *engine.Engine, version version.Version, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
|
| 980 |
+ _, err := w.Write([]byte{'O', 'K'})
|
|
| 981 |
+ return err |
|
| 982 |
+} |
|
| 983 |
+ |
|
| 979 | 984 |
func makeHttpHandler(eng *engine.Engine, logging bool, localMethod string, localRoute string, handlerFunc HttpApiFunc, enableCors bool, dockerVersion version.Version) http.HandlerFunc {
|
| 980 | 985 |
return func(w http.ResponseWriter, r *http.Request) {
|
| 981 | 986 |
// log the request |
| ... | ... |
@@ -1044,6 +1050,7 @@ func createRouter(eng *engine.Engine, logging, enableCors bool, dockerVersion st |
| 1044 | 1044 |
} |
| 1045 | 1045 |
m := map[string]map[string]HttpApiFunc{
|
| 1046 | 1046 |
"GET": {
|
| 1047 |
+ "/_ping": ping, |
|
| 1047 | 1048 |
"/events": getEvents, |
| 1048 | 1049 |
"/info": getInfo, |
| 1049 | 1050 |
"/version": getVersion, |
| ... | ... |
@@ -1162,6 +1162,27 @@ Show the docker version information |
| 1162 | 1162 |
- **200** – no error |
| 1163 | 1163 |
- **500** – server error |
| 1164 | 1164 |
|
| 1165 |
+### Ping the docker server |
|
| 1166 |
+ |
|
| 1167 |
+`GET /_ping` |
|
| 1168 |
+ |
|
| 1169 |
+Ping the docker server |
|
| 1170 |
+ |
|
| 1171 |
+ **Example request**: |
|
| 1172 |
+ |
|
| 1173 |
+ GET /_ping HTTP/1.1 |
|
| 1174 |
+ |
|
| 1175 |
+ **Example response**: |
|
| 1176 |
+ |
|
| 1177 |
+ HTTP/1.1 200 OK |
|
| 1178 |
+ |
|
| 1179 |
+ OK |
|
| 1180 |
+ |
|
| 1181 |
+ Status Codes: |
|
| 1182 |
+ |
|
| 1183 |
+ - **200** - no error |
|
| 1184 |
+ - **500** - server error |
|
| 1185 |
+ |
|
| 1165 | 1186 |
### Create a new image from a container's changes |
| 1166 | 1187 |
|
| 1167 | 1188 |
`POST /commit` |