|
@@ -8,6 +8,7 @@ import (
|
|
"os"
|
|
"os"
|
|
"path"
|
|
"path"
|
|
"regexp"
|
|
"regexp"
|
|
|
|
+ "runtime"
|
|
"strings"
|
|
"strings"
|
|
"sync"
|
|
"sync"
|
|
"time"
|
|
"time"
|
|
@@ -29,6 +30,7 @@ import (
|
|
"github.com/docker/docker/pkg/namesgenerator"
|
|
"github.com/docker/docker/pkg/namesgenerator"
|
|
"github.com/docker/docker/pkg/networkfs/resolvconf"
|
|
"github.com/docker/docker/pkg/networkfs/resolvconf"
|
|
"github.com/docker/docker/pkg/parsers"
|
|
"github.com/docker/docker/pkg/parsers"
|
|
|
|
+ "github.com/docker/docker/pkg/parsers/kernel"
|
|
"github.com/docker/docker/pkg/sysinfo"
|
|
"github.com/docker/docker/pkg/sysinfo"
|
|
"github.com/docker/docker/pkg/truncindex"
|
|
"github.com/docker/docker/pkg/truncindex"
|
|
"github.com/docker/docker/runconfig"
|
|
"github.com/docker/docker/runconfig"
|
|
@@ -767,6 +769,10 @@ func NewDaemonFromDirectory(config *daemonconfig.Config, eng *engine.Engine) (*D
|
|
if os.Geteuid() != 0 {
|
|
if os.Geteuid() != 0 {
|
|
log.Fatalf("The Docker daemon needs to be run as root")
|
|
log.Fatalf("The Docker daemon needs to be run as root")
|
|
}
|
|
}
|
|
|
|
+ if err := checkKernelAndArch(); err != nil {
|
|
|
|
+ log.Fatal(err)
|
|
|
|
+ }
|
|
|
|
+
|
|
// set up the TempDir to use a canonical path
|
|
// set up the TempDir to use a canonical path
|
|
tmp := os.TempDir()
|
|
tmp := os.TempDir()
|
|
realTmp, err := utils.ReadSymlinkedDirectory(tmp)
|
|
realTmp, err := utils.ReadSymlinkedDirectory(tmp)
|
|
@@ -1156,3 +1162,27 @@ func (daemon *Daemon) ImageGetCached(imgID string, config *runconfig.Config) (*i
|
|
}
|
|
}
|
|
return match, nil
|
|
return match, nil
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+func checkKernelAndArch() error {
|
|
|
|
+ // Check for unsupported architectures
|
|
|
|
+ if runtime.GOARCH != "amd64" {
|
|
|
|
+ return fmt.Errorf("The Docker runtime currently only supports amd64 (not %s). This will change in the future. Aborting.", runtime.GOARCH)
|
|
|
|
+ }
|
|
|
|
+ // Check for unsupported kernel versions
|
|
|
|
+ // FIXME: it would be cleaner to not test for specific versions, but rather
|
|
|
|
+ // test for specific functionalities.
|
|
|
|
+ // Unfortunately we can't test for the feature "does not cause a kernel panic"
|
|
|
|
+ // without actually causing a kernel panic, so we need this workaround until
|
|
|
|
+ // the circumstances of pre-3.8 crashes are clearer.
|
|
|
|
+ // For details see http://github.com/docker/docker/issues/407
|
|
|
|
+ if k, err := kernel.GetKernelVersion(); err != nil {
|
|
|
|
+ log.Printf("WARNING: %s\n", err)
|
|
|
|
+ } else {
|
|
|
|
+ if kernel.CompareKernelVersion(k, &kernel.KernelVersionInfo{Kernel: 3, Major: 8, Minor: 0}) < 0 {
|
|
|
|
+ if os.Getenv("DOCKER_NOWARN_KERNEL_VERSION") == "" {
|
|
|
|
+ log.Printf("WARNING: You are running linux kernel version %s, which might be unstable running docker. Please upgrade your kernel to 3.8.0.", k.String())
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return nil
|
|
|
|
+}
|