Merge pull request #19104 from vdemeester/18957-update-config

Add a specific config struct for the update command (#18957)
This commit is contained in:
Sebastiaan van Stijn 2016-01-12 09:46:19 -08:00
commit 1393c450cd
3 changed files with 12 additions and 4 deletions

View File

@ -1,6 +1,7 @@
package container
import (
"encoding/json"
"fmt"
"io"
"net/http"
@ -332,11 +333,17 @@ func (s *containerRouter) postContainerUpdate(ctx context.Context, w http.Respon
return err
}
_, hostConfig, _, err := runconfig.DecodeContainerConfig(r.Body)
if err != nil {
var updateConfig container.UpdateConfig
decoder := json.NewDecoder(r.Body)
if err := decoder.Decode(&updateConfig); err != nil {
return err
}
hostConfig := &container.HostConfig{
Resources: updateConfig.Resources,
}
name := vars["name"]
warnings, err := s.backend.ContainerUpdate(name, hostConfig)
if err != nil {

View File

@ -95,6 +95,7 @@ This section lists each version from latest to oldest. Each listing includes a
[Docker Remote API v1.22](docker_remote_api_v1.22.md) documentation
* `POST /container/(name)/update` updates the resources of a container.
* `GET /containers/json` supports filter `isolation` on Windows.
* `GET /containers/json` now returns the list of networks of containers.
* `GET /info` Now returns `Architecture` and `OSType` fields, providing information

View File

@ -1023,7 +1023,7 @@ Update resource configs of one or more containers.
Content-Type: application/json
{
"HostConfig": {
"UpdateConfig": {
"Resources": {
"BlkioWeight": 300,
"CpuShares": 512,