【问题标题】:Docker inside OpenVZ VPSOpenVZ VPS 中的 Docker
【发布时间】:2017-07-22 12:51:20
【问题描述】:

我检查了https://openvz.org/Docker_inside_CT

在我的VPS内核版本是2.6.32-042stab120.11

托管确认他们中的一些客户正在使用安装了 docker 的 Openvz。所以我应该能够运行 Docker。

我试图为我的问题找到解决方案,但没有任何成功。

我可以安装 CentOS; debian7,8; Ubuntu 14,16。 我在 debian 8 和 ubuntu 16.04 上试过,我收到了同样的问题 在安装过程中我收到错误:

Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
invoke-rc.d: initscript docker, action "start" failed.
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2017-07-22 08:01:57 EDT; 38ms ago
     Docs: https://docs.docker.com
  Process: 22638 ExecStart=/usr/bin/docker daemon -H fd:// $DOCKER_OPTS (code=exited, status=1/FAILURE)
 Main PID: 22638 (code=exited, status=1/FAILURE)

Jul 22 08:01:57 xyz systemd[1]: Starting Docker Application Container Engine...
Jul 22 08:01:57 xyz docker[22638]: time="2017-07-22T08:01:57.543399289-04:00" level=fatal msg="Your Linux kernel version 2.6.32-042stab120.11 is unstable running Docker. Please upgrade your kernel to 3.10+."
Jul 22 08:01:57 xyz systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
Jul 22 08:01:57 xyz systemd[1]: Failed to start Docker Application Container Engine.
Jul 22 08:01:57 xyz systemd[1]: docker.service: Unit entered failed state.
Jul 22 08:01:57 xyz systemd[1]: docker.service: Failed with result 'exit-code'.
dpkg: error processing package docker.io (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 docker.io
E: Sub-process /usr/bin/dpkg returned an error code (1)

docker 版本的输出

Client:
 Version:      1.10.3
 API version:  1.22
 Go version:   go1.6.1
 Git commit:   20f81dd
 Built:        Wed, 20 Apr 2016 14:19:16 -0700
 OS/Arch:      linux/amd64
An error occurred trying to connect: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.22/version: read unix @->/var/run/docker.sock: read: connection reset by peer

我不知道为什么 docker 版本不能让我恢复服务器版本以及如何强制 docker 在这台机器上工作。

如果我安装 docker-engine 1.9.1 我会得到

Jul 22 11:09:32 xyz docker[32115]: time="2017-07-22T11:09:32.413474210-04:00" level=warning msg="Your Linux kernel version 2.6.32-042stab120.11 can be unstable running docker. Please upgrade your kernel to 3.10.0."
Jul 22 11:09:32 xyz docker[32115]: time="2017-07-22T11:09:32.417040756-04:00" level=error msg="'overlay' not found as a supported filesystem on this host. Please ensure kernel is new enough and has overlay support loaded."
Jul 22 11:09:32 xyz docker[32115]: time="2017-07-22T11:09:32.420093045-04:00" level=warning msg="Running modprobe bridge br_netfilter failed with message: modprobe: ERROR: ../libkmod/libkmod.c:514 lookup_builtin_fil...be: WARNING: Modul
Jul 22 11:09:32 xyz docker[32115]: time="2017-07-22T11:09:32.421785030-04:00" level=warning msg="Running modprobe nf_nat failed with message: `modprobe: ERROR: ../libkmod/libkmod.c:514 lookup_builtin_file() could not open builtin fil...
Jul 22 11:09:32 xyz docker[32115]: time="2017-07-22T11:09:32.446647894-04:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address"
Jul 22 11:09:32 xyz docker[32115]: time="2017-07-22T11:09:32.457352813-04:00" level=fatal msg="Error starting daemon: Error initializing network controller: Error creating default \"bridge\" network: package not installed"
Jul 22 11:09:32 xyz systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
Jul 22 11:09:32 xyz systemd[1]: Failed to start Docker Application Container Engine.
Jul 22 11:09:32 xyz systemd[1]: docker.service: Unit entered failed state.
Jul 22 11:09:32 xyz systemd[1]: docker.service: Failed with result 'exit-code'.
Hint: Some lines were ellipsized, use -l to show in full.
dpkg: error processing package docker-engine (--configure):
 subprocess installed post-installation script returned error exit status 1
Processing triggers for libc-bin (2.23-0ubuntu9) ...
Processing triggers for systemd (229-4ubuntu19) ...
Errors were encountered while processing:
 docker-engine
E: Sub-process /usr/bin/dpkg returned an error code (1)

【问题讨论】:

    标签: ubuntu docker debian vps openvz


    【解决方案1】:

    使用他们的wiki 中的文档,我已经能够让 docker 在 OpenVZ 6 主机上的 CentOS 7 容器中运行,但我还没有在任何其他发行版上尝试过。

    如果您查看 wiki,请注意限制。它只能运行"vfs" storage driver,因此您失去了 docker 存储的很多好处。

    确保您的容器具有 veth 接口,而不是默认的 venet 或 docker 不会启动并且会抱怨桥接问题(可能还需要为您的容器启用桥接功能)。

    您还需要配置 docker 以使用 vfs 存储驱动程序,我从您发布的 1.9.1 错误中注意到它抱怨尝试使用覆盖存储。

    我看到另一个关于 nf_nat 的错误,表明主机在容器中限制 netfilter,需要按照 wiki 中的说明将容器的 netfilter 设置为 full。

    【讨论】:

    • 嗯,所以我需要 veth,嗯,这可能是个问题,是的。 “您还需要配置 docker 以使用 vfs 存储驱动程序” - 但我如何在安装之前进行配置?或者你提到它在安装后配置它?
    • 我只为此使用了 CentOS 7,并且在使用 RPM 时,安装时 docker 不会自动启动。为了防止 apt/dpkg 在安装后启动 docker 以便您可以配置它,您应该能够使用 /usr/sbin/policy-rc.d。应该有大量的在线文档涵盖这一点。
    猜你喜欢
    • 1970-01-01
    • 2011-12-04
    • 2015-06-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-08
    • 1970-01-01
    • 2012-05-07
    • 2021-07-25
    相关资源
    最近更新 更多