mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Remove the NO_MEMORY_LIMIT constant
This commit is contained in:
parent
640efc2ed2
commit
f68d107a13
5 changed files with 10 additions and 16 deletions
5
Makefile
5
Makefile
|
@ -13,10 +13,7 @@ endif
|
||||||
GIT_COMMIT = $(shell git rev-parse --short HEAD)
|
GIT_COMMIT = $(shell git rev-parse --short HEAD)
|
||||||
GIT_STATUS = $(shell test -n "`git status --porcelain`" && echo "+CHANGES")
|
GIT_STATUS = $(shell test -n "`git status --porcelain`" && echo "+CHANGES")
|
||||||
|
|
||||||
NO_MEMORY_LIMIT ?= 0
|
BUILD_OPTIONS = -ldflags "-X main.GIT_COMMIT $(GIT_COMMIT)$(GIT_STATUS)"
|
||||||
export NO_MEMORY_LIMIT
|
|
||||||
|
|
||||||
BUILD_OPTIONS = -ldflags "-X main.GIT_COMMIT $(GIT_COMMIT)$(GIT_STATUS) -X main.NO_MEMORY_LIMIT $(NO_MEMORY_LIMIT)"
|
|
||||||
|
|
||||||
SRC_DIR := $(GOPATH)/src
|
SRC_DIR := $(GOPATH)/src
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,6 @@ const VERSION = "0.1.6"
|
||||||
|
|
||||||
var (
|
var (
|
||||||
GIT_COMMIT string
|
GIT_COMMIT string
|
||||||
NO_MEMORY_LIMIT bool
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (srv *Server) Name() string {
|
func (srv *Server) Name() string {
|
||||||
|
|
|
@ -373,10 +373,15 @@ func (container *Container) Start() error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if container.Config.Memory > 0 && NO_MEMORY_LIMIT {
|
// Make sure the config is compatible with the current kernel
|
||||||
log.Printf("WARNING: This version of docker has been compiled without memory limit support. Discarding the limit.")
|
if container.Config.Memory > 0 && !container.runtime.capabilities.MemoryLimit {
|
||||||
|
log.Printf("WARNING: Your kernel does not support memory limit capabilities. Limitation discarded.\n")
|
||||||
container.Config.Memory = 0
|
container.Config.Memory = 0
|
||||||
}
|
}
|
||||||
|
if container.Config.Memory > 0 && !container.runtime.capabilities.SwapLimit {
|
||||||
|
log.Printf("WARNING: Your kernel does not support swap limit capabilities. Limitation discarded.\n")
|
||||||
|
container.Config.MemorySwap = -1
|
||||||
|
}
|
||||||
|
|
||||||
if err := container.generateLXCConfig(); err != nil {
|
if err := container.generateLXCConfig(); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -15,7 +15,6 @@ import (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
GIT_COMMIT string
|
GIT_COMMIT string
|
||||||
NO_MEMORY_LIMIT string
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -39,15 +38,11 @@ func main() {
|
||||||
os.Setenv("DEBUG", "1")
|
os.Setenv("DEBUG", "1")
|
||||||
}
|
}
|
||||||
docker.GIT_COMMIT = GIT_COMMIT
|
docker.GIT_COMMIT = GIT_COMMIT
|
||||||
docker.NO_MEMORY_LIMIT = NO_MEMORY_LIMIT == "1"
|
|
||||||
if *flDaemon {
|
if *flDaemon {
|
||||||
if flag.NArg() != 0 {
|
if flag.NArg() != 0 {
|
||||||
flag.Usage()
|
flag.Usage()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if NO_MEMORY_LIMIT == "1" {
|
|
||||||
log.Printf("WARNING: This version of docker has been compiled without memory limit support.")
|
|
||||||
}
|
|
||||||
if err := daemon(*pidfile); err != nil {
|
if err := daemon(*pidfile); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,8 +46,6 @@ func layerArchive(tarfile string) (io.Reader, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
NO_MEMORY_LIMIT = os.Getenv("NO_MEMORY_LIMIT") == "1"
|
|
||||||
|
|
||||||
// Hack to run sys init during unit testing
|
// Hack to run sys init during unit testing
|
||||||
if SelfPath() == "/sbin/init" {
|
if SelfPath() == "/sbin/init" {
|
||||||
SysInit()
|
SysInit()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue