10. Configuring Running Containers

Change memory available to a running container:

$ virsh --connect docker://node3.winctpreview.com setmem vpnclient<N>_winct03nano 768M
$ virsh --connect docker://node3.winctpreview.com dumpxml vpnclient<N>_winct03nano | grep -i memory
<memory unit='KiB'>786432</memory>
<currentMemory unit='KiB'>786432</currentMemory>

Edit the CPU shares of a running container (only if a CPU quota is not set):

$ virsh --connect docker://node3.winctpreview.com schedinfo vpnclient<N>_winct03nano cpu_shares=1000
Scheduler : posix
cpu_shares : 1000
vcpu_period : 0
vcpu_quota : 0

Edit the CPU quota of a running container (only if CPU shares are not set):

$ virsh --connect docker://node3.winctpreview.com schedinfo vpnclient<N>_winct03nano vcpu_period=4000 vcpu_quota=2000
Scheduler : posix
cpu_shares : 0
vcpu_period : 4000
vcpu_quota : 2000

Reset the CPU shares and quota of a running container:

$ virsh --connect docker://node3.winctpreview.com schedinfo vpnclient<N>_winct03nano cpu_shares=-1
$ virsh --connect docker://node3.winctpreview.com schedinfo vpnclient<N>_winct03nano vcpu_quota=-1
Scheduler : posix
cpu_shares : 0
vcpu_period : 0
vcpu_quota : 0

Change the total throughput limit of a running container’s device:

$ virsh --connect docker://node3.winctpreview.com domblklist vpnclient<N>_winct03nano
 Target   Source
------------------
 vda      -
$ virsh --connect docker://node3.winctpreview.com blkdeviotune vpnclient<N>_winct03nano vda --total-bytes-sec=104857600 --total-iops-sec=1000