File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -573,17 +573,20 @@ func (dm *DockerManager) runContainer(
573
573
labels [kubernetesContainerLabel ] = container .Name
574
574
}
575
575
}
576
+ memoryLimit := container .Resources .Limits .Memory ().Value ()
577
+ cpuShares := milliCPUToShares (container .Resources .Limits .Cpu ().MilliValue ())
576
578
dockerOpts := docker.CreateContainerOptions {
577
579
Name : BuildDockerName (dockerName , container ),
578
580
Config : & docker.Config {
579
581
Env : makeEnvList (opts .Envs ),
580
582
ExposedPorts : exposedPorts ,
581
583
Hostname : containerHostname ,
582
584
Image : container .Image ,
583
- Memory : container .Resources .Limits .Memory ().Value (),
584
- CPUShares : milliCPUToShares (container .Resources .Limits .Cpu ().MilliValue ()),
585
- WorkingDir : container .WorkingDir ,
586
- Labels : labels ,
585
+ // Memory and CPU are set here for older versions of Docker (pre-1.6).
586
+ Memory : memoryLimit ,
587
+ CPUShares : cpuShares ,
588
+ WorkingDir : container .WorkingDir ,
589
+ Labels : labels ,
587
590
},
588
591
}
589
592
@@ -630,6 +633,9 @@ func (dm *DockerManager) runContainer(
630
633
Binds : binds ,
631
634
NetworkMode : netMode ,
632
635
IpcMode : ipcMode ,
636
+ // Memory and CPU are set here for newer versions of Docker (1.6+).
637
+ Memory : memoryLimit ,
638
+ CPUShares : cpuShares ,
633
639
}
634
640
if len (opts .DNS ) > 0 {
635
641
hc .DNS = opts .DNS
You can’t perform that action at this time.
0 commit comments