Senthil Kumaran
Senthil Kumaran

Reputation: 56813

Docker in Docker(DND) is not starting

I have a simple Ubuntu 16.10 container which has docker.io installed.

The docker process terminates after it starts and log has this information. Any troubleshooting suggestions?

$ docker run -it --name dcos-ubuntu-python5 python-docker /bin/bash

root@5ff6bb6b6dc7:/# docker run hello-world
docker: Cannot connect to the Docker daemon. Is the docker daemon running on this host?.
See 'docker run --help'.

root@5ff6bb6b6dc7:/# service docker start
 * Starting Docker: docker                                                                                                                                          [ OK ]
root@5ff6bb6b6dc7:/# service docker status
 * Docker is not running

root@5ff6bb6b6dc7:/# tail -f /var/log/docker.log
time="2017-12-21T17:09:45.464736873Z" level=info msg="libcontainerd: new containerd process, pid: 50"
time="2017-12-21T17:09:46.472578239Z" level=fatal msg="Error starting daemon: error initializing graphdriver: operation not permitted"

Upvotes: 0

Views: 1236

Answers (3)

Senthil Kumaran
Senthil Kumaran

Reputation: 56813

The answer was simple.

docker run -it --privileged --name dcos-ubuntu-python5 python-docker /bin/bash

(This was also mentioned partly in @SunghoMoon's response. So Credits to him).

Upvotes: 0

SunghoMoon
SunghoMoon

Reputation: 1461

Why do you want to run docker within docker container?

Docker-in-Docker is developed to help docker development. And it needs --privileged flag to run docker container.(Please read jpetazzo's blog here.)

If you really want to execute docker in docker container, you also have other options.

  1. Bind mount docker.sock. Some people call this DooD(Docker-outside-of-Docker)

    docker run -v /var/run/docker.sock:/var/run/docker.sock ...

  2. Install docker(client) and specify DOCKER_HOST to access remote docker daemon. Be careful about socket protection with certificates.

Upvotes: 1

sanath meti
sanath meti

Reputation: 6519

Are you running docker as sudo if not run as sudo or

Else add user group to docker

docker group. For this run following command:

sudo usermod -aG docker $USER

Upvotes: 0

Related Questions