Run docker inside an ubuntu docker container
83
If you want to run docker inside a ubuntu docker container use this repo.
docker-v18 - contains docker v18.03 (latest stable)docker-v1 - contains docker v1.13docker-v1 - contains docker v1.13 from ubuntu's docker.io package
Dockerfile used to construct this image is -
FROM ubuntu:16.04
RUN apt-get update && apt-get install -y \
docker.io \
&& rm -rf /var/lib/apt/lists/* \
&& docker -v
VOLUME /var/lib/docker
CMD service docker start && bin/bash
docker run -it --rm --privileged coderkd10/ubuntu-dind:docker-v1
(Here --privileged is important and without it the host docker container cannot create children containers)
This will take you inside the (host) docker container. Then you can run any docker image as you like. For example we test it by trying to run alpine linux using the command - docker run -it --rm alpine, and you then you should be running docker inside a docker container.
docker-v18 contains docker version 18.03, which is the latest stable docker version.
Dockerfile used to construct this image is -
FROM ubuntu:16.04
RUN set -ex \
&& apt-get update && apt-get install -y --no-install-recommends \
apt-transport-https \
ca-certificates \
curl \
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \
&& echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable" \
> /etc/apt/sources.list.d/docker.list \
&& apt-get update \
&& apt-get install -y --no-install-recommends docker-ce \
&& apt-get purge -y --auto-remove curl \
&& rm -rf /var/lib/apt/lists/* \
&& docker -v
VOLUME /var/lib/docker
CMD service docker start && bin/bash
(This file has been adapted from the instructions mentioned in https://docs.docker.com/install/linux/docker-ce/ubuntu/#install-docker-ce)
docker run -it --rm --privileged coderkd10/ubuntu-dind:docker-v18
(as mentioned before --privileged flag is required)
Content type
Image
Digest
Size
96.4 MB
Last updated
over 8 years ago
docker pull coderkd10/ubuntu-dind:docker-v18