Docker Community Forums

Share and learn in the Docker community.

CPU throtlling does not work in "process" isolation

Hello,

CPU throttling does not work properly in “process” isolation while working fine in “hyper-v” isolation. I launch container with CPUPercent value set to 33 in both cases.
Code to deploy container and run it

Import-module docker
$config = [Docker.DotNet.Models.Config]::new()
($config.ExposedPorts = [System.Collections.Generic.Dictionary[string,object]]::new()).Add(“80/tcp”, $null)
$hostConfig = [Docker.DotNet.Models.HostConfig]::new()
$pb = new-object Docker.DotNet.Models.PortBinding
$pb.HostPort = “8080”
$hostConfig.PortBindings = [System.Collections.Generic.Dictionary[string, System.Collections.Generic.iList[Docker.DotNet.Models.PortBinding]]]::new()
$hostConfig.PortBindings.Add(“80/tcp”,[System.Collections.Generic.List[Docker.DotNet.Models.PortBinding]]::new([Docker.DotNet.Models.PortBinding]@($pb)))
$hostconfig.CPUPercent = 33
Run-ContainerImage -ImageIdOrName “artisticcheese/iis:latest” -Configuration $config -Detach -HostConfiguration $hostConfig -Name $pb.HostPort
Hyper-v


Process

JSON inspect

        "Ulimits": null,
        "CpuCount": 0,
        "CpuPercent": 33,
        "IOMaximumIOps": 0,
        "IOMaximumBandwidth": 0
    },