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 package container
import ( import (
"encoding/json"
"fmt" "fmt"
"io" "io"
"net/http" "net/http"
@ -332,11 +333,17 @@ func (s *containerRouter) postContainerUpdate(ctx context.Context, w http.Respon
return err return err
} }
_, hostConfig, _, err := runconfig.DecodeContainerConfig(r.Body) var updateConfig container.UpdateConfig
if err != nil {
decoder := json.NewDecoder(r.Body)
if err := decoder.Decode(&updateConfig); err != nil {
return err return err
} }
hostConfig := &container.HostConfig{
Resources: updateConfig.Resources,
}
name := vars["name"] name := vars["name"]
warnings, err := s.backend.ContainerUpdate(name, hostConfig) warnings, err := s.backend.ContainerUpdate(name, hostConfig)
if err != nil { 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 [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` supports filter `isolation` on Windows.
* `GET /containers/json` now returns the list of networks of containers. * `GET /containers/json` now returns the list of networks of containers.
* `GET /info` Now returns `Architecture` and `OSType` fields, providing information * `GET /info` Now returns `Architecture` and `OSType` fields, providing information
@ -120,7 +121,7 @@ This section lists each version from latest to oldest. Each listing includes a
* `GET /volumes` lists volumes from all volume drivers. * `GET /volumes` lists volumes from all volume drivers.
* `POST /volumes/create` to create a volume. * `POST /volumes/create` to create a volume.
* `GET /volumes/(name)` get low-level information about a volume. * `GET /volumes/(name)` get low-level information about a volume.
* `DELETE /volumes/(name)`remove a volume with the specified name. * `DELETE /volumes/(name)` remove a volume with the specified name.
* `VolumeDriver` was moved from `config` to `HostConfig` to make the configuration portable. * `VolumeDriver` was moved from `config` to `HostConfig` to make the configuration portable.
* `GET /images/(name)/json` now returns information about an image's `RepoTags` and `RepoDigests`. * `GET /images/(name)/json` now returns information about an image's `RepoTags` and `RepoDigests`.
* The `config` option now accepts the field `StopSignal`, which specifies the signal to use to kill a container. * The `config` option now accepts the field `StopSignal`, which specifies the signal to use to kill a container.

View File

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