mirror of
https://github.com/clearlinux/docker.git
synced 2026-09-06 05:31:47 +00:00
rename a existing container
Closes #3036 Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
This commit is contained in:
committed by
Srini Brahmaroutu
parent
9b0072a7e6
commit
21a809d9ae
@@ -739,6 +739,24 @@ func postContainersRestart(eng *engine.Engine, version version.Version, w http.R
|
||||
return nil
|
||||
}
|
||||
|
||||
func postContainerRename(eng *engine.Engine, version version.Version, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
||||
if err := parseForm(r); err != nil {
|
||||
return err
|
||||
}
|
||||
if vars == nil {
|
||||
return fmt.Errorf("Missing parameter")
|
||||
}
|
||||
|
||||
newName := r.URL.Query().Get("name")
|
||||
job := eng.Job("container_rename", vars["name"], newName)
|
||||
job.Setenv("t", r.Form.Get("t"))
|
||||
if err := job.Run(); err != nil {
|
||||
return err
|
||||
}
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
return nil
|
||||
}
|
||||
|
||||
func deleteContainers(eng *engine.Engine, version version.Version, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
||||
if err := parseForm(r); err != nil {
|
||||
return err
|
||||
@@ -1311,6 +1329,7 @@ func createRouter(eng *engine.Engine, logging, enableCors bool, dockerVersion st
|
||||
"/containers/{name:.*}/exec": postContainerExecCreate,
|
||||
"/exec/{name:.*}/start": postContainerExecStart,
|
||||
"/exec/{name:.*}/resize": postContainerExecResize,
|
||||
"/containers/{name:.*}/rename": postContainerRename,
|
||||
},
|
||||
"DELETE": {
|
||||
"/containers/{name:.*}": deleteContainers,
|
||||
|
||||
Reference in New Issue
Block a user