在Ubuntu Docker映像上运行Docker

在Ubuntu Docker映像上运行Docker,ubuntu,docker,containers,dockerfile,Ubuntu,Docker,Containers,Dockerfile,我无法让Docker CE在Ubuntu Docker映像上运行。这是我的Dockerfile: FROM ubuntu:16.04 RUN apt-get update && apt-get install -y curl apt-transport-https ca-certificates curl gnupg2 software-properties-common RUN curl -fsSL https://download.docker.com/linux/ubun

我无法让Docker CE在Ubuntu Docker映像上运行。这是我的
Dockerfile

FROM ubuntu:16.04

RUN apt-get update && apt-get install -y curl apt-transport-https ca-certificates curl gnupg2 software-properties-common
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
RUN add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
RUN apt-get update && apt-get install -y docker-ce

RUN docker info
最后一个命令失败,原因如下:

ERRO[2018-04-12T14:35:43.945962200Z] 'overlay2' is not supported over overlayfs
INFO[2018-04-12T14:35:43.974187900Z] Graph migration to content-addressability took 0.00 seconds
INFO[2018-04-12T14:35:43.976355700Z] Loading containers: start.
WARN[2018-04-12T14:35:43.978060300Z] Running modprobe bridge br_netfilter failed with message: , error: exec: "modprobe": executable file not found in $PATH
WARN[2018-04-12T14:35:43.978173000Z] Running modprobe nf_nat failed with message: ``, error: exec: "modprobe": executable file not found in $PATH
WARN[2018-04-12T14:35:43.978965200Z] Running modprobe xt_conntrack failed with message: ``, error: exec: "modprobe": executable file not found in $PATH
Error starting daemon: Error initializing network controller: error obtaining controller instance: failed to create NAT chain: iptables failed: iptables -t nat -N DOCKER: iptables v1.6.0: can't initialize iptables table `nat': Permission denied (you must be root)
Perhaps iptables or your kernel needs to be upgraded.
 (exit status 3)
无法连接到位于的Docker守护程序unix:///var/run/docker.sock. docker守护进程正在运行吗?

如果我试图从容器中运行
dockerd
,它将返回以下内容:

ERRO[2018-04-12T14:35:43.945962200Z] 'overlay2' is not supported over overlayfs
INFO[2018-04-12T14:35:43.974187900Z] Graph migration to content-addressability took 0.00 seconds
INFO[2018-04-12T14:35:43.976355700Z] Loading containers: start.
WARN[2018-04-12T14:35:43.978060300Z] Running modprobe bridge br_netfilter failed with message: , error: exec: "modprobe": executable file not found in $PATH
WARN[2018-04-12T14:35:43.978173000Z] Running modprobe nf_nat failed with message: ``, error: exec: "modprobe": executable file not found in $PATH
WARN[2018-04-12T14:35:43.978965200Z] Running modprobe xt_conntrack failed with message: ``, error: exec: "modprobe": executable file not found in $PATH
Error starting daemon: Error initializing network controller: error obtaining controller instance: failed to create NAT chain: iptables failed: iptables -t nat -N DOCKER: iptables v1.6.0: can't initialize iptables table `nat': Permission denied (you must be root)
Perhaps iptables or your kernel needs to be upgraded.
 (exit status 3)
我假设
ubuntu
图像的内核中缺少什么

以下是容器的
uname-a
输出:

root@85bdefe67e4a:/# uname -a
Linux 85bdefe67e4a 4.9.87-linuxkit-aufs #1 SMP Wed Mar 14 15:12:16 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

是ubuntu:16.04的容器出了问题还是我忘记了什么?

这已经完成了。它在docker中被称为docker


Docker映像已经存在于上,您可以在下查看源代码。

只是为了进一步澄清,为什么要在Docker的容器中运行Docker?今天,我将用Docker中的一个正在工作的裸体Docker来回答您的问题,我在生产中工作得很好。。。方法是不在容器内安装docker,而是侧向加载docker,以便从容器内启用docker命令@hichamx问为什么?因为我的云托管提供商无法在生产环境中为我提供根目录,所以我在github webhook服务器上安装了所有根目录,从devops容器中启动docker映像重建并重新启动。。。透明、可维护且无任何第三方CI供应商中间人怪物出于我的目的(从BitBucket管道构建和推送Docker映像),我意识到BitBucket在提到的@ScottStensland配置中已经具备了这一功能: