在Raspberry Pi上运行Docker时,启动容器会不时出现故障

时间:2014-02-27 16:59:43

标签: raspberry-pi docker raspbian

我已经通过运行Resin.io blog中描述的步骤安装了Docker(0.8.0-1)。基本上,一切都运行良好,我能够启动docker守护进程以及运行客户端。

不幸的是,当我尝试运行容器时,有时会失败。这不依赖于实际容器,因为当您重复它运行的命令时。有时它需要两次以上的试验,有时它也会在第一次尝试时起作用。我的run命令基本上如下:

$ docker run -i -t --rm=true resin/rpi-raspbian bash

所以,到目前为止没有什么花哨的......我得到的错误信息只告诉我容器以code 1退出,无论这意味着什么。

基本上,当我尝试build一个Dockerfile时会发生同样的情况:通常它只能用于一个步骤,而在下一个步骤失败。当Docker在内部缓存结果时,您可以通过一次又一次地手动执行它来构建Dockerfile,并且在每次运行时都可以更进一步。如果失败,请再次code 1

确切的错误消息是:

  

2014/02/27 18:15:45错误:开始:无法启动容器99fc6a3327fb4af25e6c7a07d992009dde8a5425de89f44aae76ce4740e09492:退出状态1

令我惊讶的是,当我之后运行docker ps -a时,容器没有被移除(至少,那些无法创建的容器仍然存在) - 而且,更令人惊讶的是,这个命令将状态代码列为-1

当我运行

时,我在日志中看不到任何内容
$ docker logs 99fc

关于可能导致这些问题的任何想法?

更新

不幸的是,系统上既没有/var/log/messages文件夹也没有/var/log/syslog文件夹,但如果我运行dmesg,则最后一行是:

[56954.479079] device veth4FI4FH entered promiscuous mode
[56955.270388] docker0: port 1(veth4FI4FH) entered forwarding state
[56955.270493] docker0: port 1(veth4FI4FH) entered forwarding state
[56955.480603] docker0: port 1(veth4FI4FH) entered disabled state
[56955.484685] device veth4FI4FH left promiscuous mode
[56955.484726] docker0: port 1(veth4FI4FH) entered disabled state

更新2

我现在发现我通过调用journalctl来获取扩展日志(因为我在基于systemd的系统上)。我得到的是:

Feb 28 09:31:02 white docker[123]: 2014/02/28 09:31:02 POST /v1.9/containers/create
Feb 28 09:31:02 white docker[123]: [/docker|5cd5747f] +job create()
Feb 28 09:31:02 white docker[123]: [/docker|5cd5747f] -job create() = OK (0)
Feb 28 09:31:02 white docker[123]: 2014/02/28 09:31:02 POST /v1.9/containers/8d2928a6a4b4c57aa2760a3681a5fbcf53f890e85d6830b97b9245366d284916/attach?stderr=1&stdin=1&stdout=1&stream=1
Feb 28 09:31:02 white docker[123]: [/docker|5cd5747f] +job inspect(8d2928a6a4b4c57aa2760a3681a5fbcf53f890e85d6830b97b9245366d284916, container)
Feb 28 09:31:02 white docker[123]: [/docker|5cd5747f] -job inspect(8d2928a6a4b4c57aa2760a3681a5fbcf53f890e85d6830b97b9245366d284916, container) = OK (0)
Feb 28 09:31:02 white docker[123]: [/docker|5cd5747f] +job attach(8d2928a6a4b4c57aa2760a3681a5fbcf53f890e85d6830b97b9245366d284916)
Feb 28 09:31:02 white docker[123]: 2014/02/28 09:31:02 POST /v1.9/containers/8d2928a6a4b4c57aa2760a3681a5fbcf53f890e85d6830b97b9245366d284916/start
Feb 28 09:31:02 white docker[123]: [/docker|5cd5747f] +job start(8d2928a6a4b4c57aa2760a3681a5fbcf53f890e85d6830b97b9245366d284916)
Feb 28 09:31:02 white docker[123]: [/docker|5cd5747f] +job allocate_interface(8d2928a6a4b4c57aa2760a3681a5fbcf53f890e85d6830b97b9245366d284916)
Feb 28 09:31:02 white docker[123]: [/docker|5cd5747f] -job allocate_interface(8d2928a6a4b4c57aa2760a3681a5fbcf53f890e85d6830b97b9245366d284916) = OK (0)
Feb 28 09:31:02 white docker[123]: [/docker|5cd5747f] +job allocate_port(8d2928a6a4b4c57aa2760a3681a5fbcf53f890e85d6830b97b9245366d284916)
Feb 28 09:31:02 white docker[123]: [/docker|5cd5747f] -job allocate_port(8d2928a6a4b4c57aa2760a3681a5fbcf53f890e85d6830b97b9245366d284916) = OK (0)
Feb 28 09:31:03 white docker[123]: [error] container.go:1244 Error running container: exit status 1
Feb 28 09:31:03 white docker[123]: [/docker|5cd5747f] +job release_interface(8d2928a6a4b4c57aa2760a3681a5fbcf53f890e85d6830b97b9245366d284916)
Feb 28 09:31:03 white kernel: device vethHXP55Y entered promiscuous mode
Feb 28 09:31:03 white avahi-daemon[131]: Withdrawing workstation service for vethUTI4YT.
Feb 28 09:31:03 white docker[123]: [/docker|5cd5747f] -job release_interface(8d2928a6a4b4c57aa2760a3681a5fbcf53f890e85d6830b97b9245366d284916) = OK (0)
Feb 28 09:31:03 white docker[123]: [/docker|5cd5747f] -job attach(8d2928a6a4b4c57aa2760a3681a5fbcf53f890e85d6830b97b9245366d284916) = OK (0)
Feb 28 09:31:04 white docker[123]: [/docker|5cd5747f] +job release_interface(8d2928a6a4b4c57aa2760a3681a5fbcf53f890e85d6830b97b9245366d284916)
Feb 28 09:31:04 white docker[123]: 2014/02/28 09:31:04 Unable to unmap port 0.0.0.0:80: port is not mapped
Feb 28 09:31:04 white docker[123]: [/docker|5cd5747f] -job release_interface(8d2928a6a4b4c57aa2760a3681a5fbcf53f890e85d6830b97b9245366d284916) = OK (0)
Feb 28 09:31:04 white docker[123]: [error] container.go:1299 8d2928a6a4b4c57aa2760a3681a5fbcf53f890e85d6830b97b9245366d284916: Error closing Pty master: invalid argument
Feb 28 09:31:04 white kernel: docker0: port 1(vethHXP55Y) entered forwarding state
Feb 28 09:31:04 white kernel: docker0: port 1(vethHXP55Y) entered forwarding state
Feb 28 09:31:04 white docker[123]: Cannot start container 8d2928a6a4b4c57aa2760a3681a5fbcf53f890e85d6830b97b9245366d284916: exit status 1[/docker|5cd5747f] -job start(8d2928a6a4b4c57aa2760a3681a5fbcf53f890e85d6830b97b9245366d284916) = ERR (1)
Feb 28 09:31:04 white docker[123]: [error] api.go:959 Error: start: Cannot start container 8d2928a6a4b4c57aa2760a3681a5fbcf53f890e85d6830b97b9245366d284916: exit status 1
Feb 28 09:31:04 white docker[123]: [error] api.go:91 HTTP Error: statusCode=500 start: Cannot start container 8d2928a6a4b4c57aa2760a3681a5fbcf53f890e85d6830b97b9245366d284916: exit status 1
Feb 28 09:31:04 white kernel: docker0: port 1(vethHXP55Y) entered disabled state
Feb 28 09:31:04 white avahi-daemon[131]: Withdrawing workstation service for vethHXP55Y.
Feb 28 09:31:04 white kernel: device vethHXP55Y left promiscuous mode
Feb 28 09:31:04 white kernel: docker0: port 1(vethHXP55Y) entered disabled state

显然问题在于container.go:1244尝试启动容器时。

这有任何帮助吗?

1 个答案:

答案 0 :(得分:4)

当你使用我们的树脂端口码头时,我会假设你正在运行Arch linux。在Arch中,最新的lxc软件包是lxc-1.0,而docker已知这个版本的lxc [1]存在问题。

将lxc降级为0.9或0.8可以解决问题。 Arch保留最近在/var/cache/pacman/pkg下载的包的缓存。因此,以root身份执行pacman -U /var/cache/pacman/pkg/lxc-<VERSION>,然后重新启动docker守护程序。

如果您没有找到缓存包,那么您可以在此处找到更多方法[2]。

[1] https://github.com/dotcloud/docker/issues/4298

[2] https://wiki.archlinux.org/index.php/Downgrading_Packages