... | ... |
@@ -13,10 +13,7 @@ endif |
13 | 13 |
GIT_COMMIT = $(shell git rev-parse --short HEAD) |
14 | 14 |
GIT_STATUS = $(shell test -n "`git status --porcelain`" && echo "+CHANGES") |
15 | 15 |
|
16 |
-NO_MEMORY_LIMIT ?= 0 |
|
17 |
-export NO_MEMORY_LIMIT |
|
18 |
- |
|
19 |
-BUILD_OPTIONS = -ldflags "-X main.GIT_COMMIT $(GIT_COMMIT)$(GIT_STATUS) -X main.NO_MEMORY_LIMIT $(NO_MEMORY_LIMIT)" |
|
16 |
+BUILD_OPTIONS = -ldflags "-X main.GIT_COMMIT $(GIT_COMMIT)$(GIT_STATUS)" |
|
20 | 17 |
|
21 | 18 |
SRC_DIR := $(GOPATH)/src |
22 | 19 |
|
... | ... |
@@ -373,10 +373,15 @@ func (container *Container) Start() error { |
373 | 373 |
return err |
374 | 374 |
} |
375 | 375 |
|
376 |
- if container.Config.Memory > 0 && NO_MEMORY_LIMIT { |
|
377 |
- log.Printf("WARNING: This version of docker has been compiled without memory limit support. Discarding the limit.") |
|
376 |
+ // Make sure the config is compatible with the current kernel |
|
377 |
+ if container.Config.Memory > 0 && !container.runtime.capabilities.MemoryLimit { |
|
378 |
+ log.Printf("WARNING: Your kernel does not support memory limit capabilities. Limitation discarded.\n") |
|
378 | 379 |
container.Config.Memory = 0 |
379 | 380 |
} |
381 |
+ if container.Config.Memory > 0 && !container.runtime.capabilities.SwapLimit { |
|
382 |
+ log.Printf("WARNING: Your kernel does not support swap limit capabilities. Limitation discarded.\n") |
|
383 |
+ container.Config.MemorySwap = -1 |
|
384 |
+ } |
|
380 | 385 |
|
381 | 386 |
if err := container.generateLXCConfig(); err != nil { |
382 | 387 |
return err |
... | ... |
@@ -14,8 +14,7 @@ import ( |
14 | 14 |
) |
15 | 15 |
|
16 | 16 |
var ( |
17 |
- GIT_COMMIT string |
|
18 |
- NO_MEMORY_LIMIT string |
|
17 |
+ GIT_COMMIT string |
|
19 | 18 |
) |
20 | 19 |
|
21 | 20 |
func main() { |
... | ... |
@@ -39,15 +38,11 @@ func main() { |
39 | 39 |
os.Setenv("DEBUG", "1") |
40 | 40 |
} |
41 | 41 |
docker.GIT_COMMIT = GIT_COMMIT |
42 |
- docker.NO_MEMORY_LIMIT = NO_MEMORY_LIMIT == "1" |
|
43 | 42 |
if *flDaemon { |
44 | 43 |
if flag.NArg() != 0 { |
45 | 44 |
flag.Usage() |
46 | 45 |
return |
47 | 46 |
} |
48 |
- if NO_MEMORY_LIMIT == "1" { |
|
49 |
- log.Printf("WARNING: This version of docker has been compiled without memory limit support.") |
|
50 |
- } |
|
51 | 47 |
if err := daemon(*pidfile); err != nil { |
52 | 48 |
log.Fatal(err) |
53 | 49 |
} |