Koding是一个协作编程环境,它为多个用户创建一个虚拟机来协作进行软件开发。他们使用 Linux 容器来虚拟化机器。我无法在上面安装 docker:
tiagoboldt@vm-2:~$ sudo docker build -t mongo .
[sudo] password for tiagoboldt:
Uploading context 645.1 kB
Uploading context
Step 0 : FROM ubuntu:latest
Pulling repository ubuntu
9cd978db300e: Error pulling image (latest) from ubuntu, endpoint: https://cdn-registry-1.docker.io/v1/, Driver aufs failed to get image rootfs 6170bb7b0ad1003a827e4dc5253ba49f6719599eac485db51eaafd507c13c311:
9cd978db300e: Error pulling image (latest) from ubuntu, Driver aufs failed to get image rootfs 6170bb7b0ad1003a827e4dc5253ba49f6719599eac485db51eaafd507c13c311: permission denied
6170bb7b0ad1: Error downloading dependent layers
2014/02/28 03:32:55 build: pull: Could not find repository on any of the indexed registries.
任何人都可以建议安装 docker 的解决方法吗?
最佳答案
是的,docker 可以在 linux 容器中运行。
但 docker 只能在 lxc
执行驱动程序和 unconfined lxc 中运行。
那么,下面是如何在 LXC 中获取 docker:
确保您有
lxc.aa_profile = lxc-container-default-with-nesting
(如果它不起作用或您没有此配置文件,请尝试lxc .aa_profile = unconfined
) 在 LXC 的config
文件中,以确保它不会被apparmor
阻止。如需更多信息,请访问(或修改)/etc/apparmor.d/lxc
中的文件。你需要在你的容器中安装 lxc。例如,如果您在 ubuntu 下,请在容器中运行
apt-get install lxc
。确保使用
--exec-driver=lxc
参数调用 docker 守护程序。您可以通过手动发出docker -d --exec-driver=lxc
来测试它。在 ubuntu 中,要在启动时使用参数,只需编辑/etc/default/docker
并确保您有以下行:
DOCKER_OPTS="--exec-driver=lxc"
关注此线程以获取更新:https://github.com/docker/docker/issues/6783
如果需要排错:
- 密切关注主机内核日志中的
apparmor
日志。 - 手动启动
docker -d ...
以获取输出。
注意:您可能无法通过判断其他人的答案来修改 Koding 上的 LXC apparmor 脚本,无论如何,如果您是 LXC 提供者,这个方法仍然很有趣,它回答了您遇到的更普遍的问题在您的问题标题中提出,这可能会在更一般的情况下吸引人们(就像我一样)。
关于linux - docker 可以在 Linux 容器中运行吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22085657/