Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot remove "cpuset-cpus" value from a container using "docker update" functionality. #41946

Open
DaneEveritt opened this issue Jan 28, 2021 · 1 comment

Comments

@DaneEveritt
Copy link

DaneEveritt commented Jan 28, 2021

Description
When attempting to update the CpusetCpus field value on a running container there does not appear to be a scenario in which you can actually set the field to an empty value. It looks like this logic is preventing me from being able to unset any values when performing the update.

Steps to reproduce the issue:

  1. Create a container of your choice, and set the --cpuset-cpus (CpusetCpus) field to some non-empty value, lets use 0,1.
  2. Using either the ContainerUpdate command from the Go client, or the docker update CLI command, attempt to set the CpusetCpus field to an empty string value (e.g. no limitation).
  3. No changes are applied, even though an empty string is provided.

Describe the results you received:

vagrant@wings:~$ docker update --cpuset-cpus "" 5e0b3372-e378-42f2-93a5-06faca2d42f0
5e0b3372-e378-42f2-93a5-06faca2d42f0
vagrant@wings:~$ docker inspect --format="{{.HostConfig.CpusetCpus}}" 5e0b3372-e378-42f2-93a5-06faca2d42f0
0,1
vagrant@wings:~$ docker update --cpuset-cpus 5e0b3372-e378-42f2-93a5-06faca2d42f0
"docker update" requires at least 1 argument.
See 'docker update --help'.

Usage:  docker update [OPTIONS] CONTAINER [CONTAINER...]

Update configuration of one or more containers
vagrant@wings:~$ docker update --cpuset-cpus="" 5e0b3372-e378-42f2-93a5-06faca2d42f0
5e0b3372-e378-42f2-93a5-06faca2d42f0
vagrant@wings:~$ docker inspect --format="{{.HostConfig.CpusetCpus}}" 5e0b3372-e378-42f2-93a5-06faca2d42f0
0,1

The same thing occurs when using the Go client and passing through the following example code (this is truncated a bit for the sake of this report):

client.ContainerUpdate(context.Background(), "5e0b3372-e378-42f2-93a5-06faca2d42f0", container.UpdateConfig{
    Resources: container.Resources{
        CpusetCpus: "",
    },
})

Describe the results you expected:
I expected that the CpusetCpus field would be blank for the container after updating it.

Output of docker version:

vagrant@wings:~$ docker --version
Docker version 20.10.2, build 2291f61

Output of docker info:

vagrant@wings:~$ docker info
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)

Server:
 Containers: 1
  Running: 1
  Paused: 0
  Stopped: 0
 Images: 2
 Server Version: 20.10.2
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 269548fa27e0089a8b8278fc4fc781d7f65a939b
 runc version: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: default
 Kernel Version: 4.15.0-128-generic
 Operating System: Ubuntu 18.04.5 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 2
 Total Memory: 1.946GiB
 Name: wings
 ID: SAA7:OROC:222X:3GN4:BHUH:QZ6U:ZS43:LYJS:MUNA:ELAH:ODVB:ARWL
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: No swap limit support

Additional environment details (AWS, VirtualBox, physical, etc.):
Running in a VirtualBox environment on Ubuntu 20.

vagrant@wings:~$ uname -a
Linux wings 4.15.0-128-generic #131-Ubuntu SMP Wed Dec 9 06:57:35 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
@DaneEveritt
Copy link
Author

It also appears you cannot unset a memory reservation based on the highlighted logic in this report, but I can open a separate bug report if that would be more useful.

vagrant@wings:~$ docker update --memory 0 61a79ac7217c
61a79ac7217c
vagrant@wings:~$ docker inspect --format="{{.HostConfig.Memory}}" 61a79ac7217c
588800000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant