chenjr0719 / Docker-in-docker

Using Docker in docker container

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Docker-in-docker

Using Docker in docker container. This container can using the Docker daemon on the host to simulate the nested docker container.

How to use

  1. Run this cntainer. Rememver you must mount the docker daemon to this container

    docker run -it --name did -v /var/run/docker.sock:/var/run/docker.sock chenjr0719/did
  2. Use docker command

    docker ps
    docker images

How it works

Its quiet simple, just using the docker CLI to access the Docker daemon socket on the host.

  1. Run a container with docker daemon

    docker run -it -v /var/run/docker.sock:/var/run/docker.sock ubuntu:18.04 bash
  2. Add Docker repository

    apt-get update
    apt-get install -y \
        apt-transport-https \
        ca-certificates \
        curl \
        software-properties-common
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
    apt-key fingerprint 0EBFCD88
    add-apt-repository \
    "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
    $(lsb_release -cs) \
    stable"
  3. Install Docker CLI in container

    apt-get update
    apt-get install -y docker-ce-cli
  4. Using Docker in container

    docker ps
    docker images

Related projects

About

Using Docker in docker container

License:MIT License


Languages

Language:Dockerfile 100.0%