mirror of https://github.com/docker/docs.git
Merge pull request #538 from jimmyxian/master
Implement 'docker commit' api
This commit is contained in:
commit
e1e7259b8a
|
|
@ -16,7 +16,6 @@ Some endpoints have not yet been implemented and will return a 404 error.
|
||||||
GET "/images/get"
|
GET "/images/get"
|
||||||
GET "/containers/{name:.*}/attach/ws"
|
GET "/containers/{name:.*}/attach/ws"
|
||||||
|
|
||||||
POST "/commit"
|
|
||||||
POST "/build"
|
POST "/build"
|
||||||
POST "/images/load"
|
POST "/images/load"
|
||||||
POST "/images/{name:.*}/push"
|
POST "/images/{name:.*}/push"
|
||||||
|
|
|
||||||
25
api/api.go
25
api/api.go
|
|
@ -423,6 +423,29 @@ func proxyRandom(c *context, w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// POST /commit
|
||||||
|
func postCommit(c *context, w http.ResponseWriter, r *http.Request) {
|
||||||
|
if err := r.ParseForm(); err != nil {
|
||||||
|
httpError(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
vars := make(map[string]string)
|
||||||
|
vars["name"] = r.Form.Get("container")
|
||||||
|
|
||||||
|
// get container
|
||||||
|
container, err := getContainerFromVars(c, vars)
|
||||||
|
if err != nil {
|
||||||
|
httpError(w, err.Error(), http.StatusNotFound)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// proxy commit request to the right node
|
||||||
|
if err := proxy(c.tlsConfig, container.Node.Addr(), w, r); err != nil {
|
||||||
|
httpError(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Proxy a hijack request to the right node
|
// Proxy a hijack request to the right node
|
||||||
func proxyHijack(c *context, w http.ResponseWriter, r *http.Request) {
|
func proxyHijack(c *context, w http.ResponseWriter, r *http.Request) {
|
||||||
container, err := getContainerFromVars(c, mux.Vars(r))
|
container, err := getContainerFromVars(c, mux.Vars(r))
|
||||||
|
|
@ -484,7 +507,7 @@ func createRouter(c *context, enableCors bool) *mux.Router {
|
||||||
},
|
},
|
||||||
"POST": {
|
"POST": {
|
||||||
"/auth": proxyRandom,
|
"/auth": proxyRandom,
|
||||||
"/commit": notImplementedHandler,
|
"/commit": postCommit,
|
||||||
"/build": notImplementedHandler,
|
"/build": notImplementedHandler,
|
||||||
"/images/create": postImagesCreate,
|
"/images/create": postImagesCreate,
|
||||||
"/images/load": notImplementedHandler,
|
"/images/load": notImplementedHandler,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue