Fela Maslen
Fela Maslen

Reputation: 2172

Running Docker on Ubuntu docker image

I'm having trouble getting Docker CE to run on an Ubuntu Docker image. Here's my 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

The last command fails with the following:

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

If I attempt to run dockerd from the container, it comes back with the following:

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)

I assume there is something missing in the kernel for the ubuntu image?

Here's the output of uname -a, from the container:

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

Is it something wrong with the ubuntu:16.04 container or is there something I'm forgetting?

Upvotes: 1

Views: 2155

Answers (1)

yamenk
yamenk

Reputation: 51876

This has already been done. It is called docker in docker.

The Docker image already exists on Dockerhub and you can check the source code under dind.

Upvotes: 2

Related Questions