mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Add a specific config for the update command
This allows to define clearly what is mutable or not in a container and remove the use of the internal HostConfig struct to be used. Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
parent
05de2aadff
commit
a4f6920731
3 changed files with 12 additions and 4 deletions
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
@ -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.
|
||||
* `POST /volumes/create` to create 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.
|
||||
* `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.
|
||||
|
|
|
@ -1023,7 +1023,7 @@ Update resource configs of one or more containers.
|
|||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"HostConfig": {
|
||||
"UpdateConfig": {
|
||||
"Resources": {
|
||||
"BlkioWeight": 300,
|
||||
"CpuShares": 512,
|
||||
|
|
Loading…
Reference in a new issue