github.com/vvnotw/moby@v1.13.1/daemon/update_linux.go (about) 1 // +build linux 2 3 package daemon 4 5 import ( 6 "github.com/docker/docker/api/types/container" 7 "github.com/docker/docker/libcontainerd" 8 ) 9 10 func toContainerdResources(resources container.Resources) libcontainerd.Resources { 11 var r libcontainerd.Resources 12 r.BlkioWeight = uint64(resources.BlkioWeight) 13 r.CpuShares = uint64(resources.CPUShares) 14 r.CpuPeriod = uint64(resources.CPUPeriod) 15 r.CpuQuota = uint64(resources.CPUQuota) 16 r.CpusetCpus = resources.CpusetCpus 17 r.CpusetMems = resources.CpusetMems 18 r.MemoryLimit = uint64(resources.Memory) 19 if resources.MemorySwap > 0 { 20 r.MemorySwap = uint64(resources.MemorySwap) 21 } 22 r.MemoryReservation = uint64(resources.MemoryReservation) 23 r.KernelMemoryLimit = uint64(resources.KernelMemory) 24 return r 25 }