Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.

README.md

docker-in-docker

Table of Contents

docker dind plugin

I have created a docker dind CLI plugin that utilizes the dind_docker_enterprise script for launching dind environments. Symlink (do not copy!) the docker-dind script to ~/.docker/cli-plugins/docker-dind in order to use the plugin. Once you have done so, instead of calling ./dind_docker_enterprise <arguments>, utilize the syntax docker dind <arguments>.

Docker Enterprise (Docker Engine Enterprise, UCP and DTR)

Stop! Look at scripts for tools to automatically create a Swarm mode cluster, a UCP cluster, or a Docker Enterprise (both UCP & DTR) cluster. You can even start a preconfigured Jenkins to use for demos. If you want to manually stand up an engine or Swarm mode cluster, read on. Also see the docker dind CLI plugin

Image Tags

For a complete list of published images, see the list of tags on Docker Hub. For each major release, the specific Docker Enterprise bugfix versions are also available and can be found via Docker Hub. If you always want to use the latest of a given platform release, stick with the 17.06-ee (or the like image for that platform release) image.

Build images (optional)

Expand for more details

The images are published to Docker Hub so you do not need to build them unless you want to,

Note: your <DOCKER-EE-URL> value can be found from https://store.docker.com/?overlay=subscriptions

  • Docker CE (stable)

    docker build \
      -t mbentley/docker-in-docker:17.03-ce \
      -t mbentley/docker-in-docker:ce \
      -f Dockerfile.ce .
    
  • Docker CE (test)

    docker build \
      -t mbentley/docker-in-docker:test-ce \
      -f Dockerfile.test-ce .
    
  • Docker CE (edge)

    docker build \
      -t mbentley/docker-in-docker:edge-ce \
      -f Dockerfile.edge-ce .
    
  • Docker Enterprise (stable)

    docker build \
      --build-arg DOCKER_EE_URL="<DOCKER-EE-URL>" \
      --build-arg DOCKER_EE_REPO="stable" \
      -t mbentley/docker-in-docker:ee \
      -f Dockerfile.ee .
    
    docker push mbentley/docker-in-docker:ee
    
  • Docker Enterprise (stable-18.09)

    docker build \
      --build-arg DOCKER_EE_URL="<DOCKER-EE-URL>" \
      --build-arg DOCKER_EE_REPO="stable-18.09" \
      -t mbentley/docker-in-docker:18.09-ee \
      -f Dockerfile.ee-with-cli .
    
    docker push mbentley/docker-in-docker:18.09-ee
    
  • Docker EE (stable-18.03)

    docker build \
      --build-arg DOCKER_EE_URL="<DOCKER-EE-URL>" \
      --build-arg DOCKER_EE_REPO="stable-18.03" \
      -t mbentley/docker-in-docker:18.03-ee \
      -f Dockerfile.ee .
    
    docker push mbentley/docker-in-docker:18.03-ee
    
  • Docker EE (stable-17.06)

    docker build \
      --build-arg DOCKER_EE_URL="<DOCKER-EE-URL>" \
      --build-arg DOCKER_EE_REPO="stable-17.06" \
      -t mbentley/docker-in-docker:17.06-ee \
      -f Dockerfile.ee .
    
    docker push mbentley/docker-in-docker:17.06-ee
    
  • Docker EE (stable-17.03)

    docker build \
      --build-arg DOCKER_EE_URL="<DOCKER-EE-URL>" \
      --build-arg DOCKER_EE_REPO="stable-17.03" \
      -t mbentley/docker-in-docker:17.03-ee \
      -f Dockerfile.ee .
    
    docker push mbentley/docker-in-docker:17.03-ee
    
  • Docker Enterprise (test)

    docker build \
      --build-arg DOCKER_EE_URL="<DOCKER-EE-URL>" \
      --build-arg DOCKER_EE_REPO="test" \
      -t mbentley/docker-in-docker:test-ee \
      -f Dockerfile.ee .
    
    docker push mbentley/docker-in-docker:test-ee
    
  • Docker CS Engine 1.12

    docker build \
      -t mbentley/docker-in-docker:1.12-cs \
      -f Dockerfile.cs-1.12 .
    
    docker push mbentley/docker-in-docker:1.12-ce
    
  • Docker CS Engine 1.10

    docker build \
      -t mbentley/docker-in-docker:1.10-cs \
      -f Dockerfile.cs-1.10 .
    
    docker push mbentley/docker-in-docker:1.10-cs
    
  • Docker CS Engine 1.9

    docker build \
      -t mbentley/docker-in-docker:1.9-cs \
      -f Dockerfile.cs-1.9 .
    
    docker push mbentley/docker-in-docker:1.9-cs
    

Prerequisites

  • Docker for Mac installed
  • Must have the following ports available on your host:
    • 1000 - TCP connection to a single Docker engine (or whatever you specify)
    • 1001, 1002, 1003 - TCP connection to Docker engines for Swarm mode (or whatever you specify)

Single engine

  1. Start engine

    docker run -d \
      --name docker \
      --hostname docker \
      --restart unless-stopped \
      --privileged \
      -p 127.0.0.1:1000:2375 \
      -v /lib/modules:/lib/modules:ro \
      -v docker-root:/root \
      -v docker-etc-docker:/etc/docker \
      -v docker-var-lib-docker:/var/lib/docker \
      -v docker-etc-cni:/etc/cni \
      -v docker-opt-cni:/opt/cni \
      -v docker-usr-libexec-kubernetes:/usr/libexec/kubernetes \
      -v docker-var-lib-kubelet:/var/lib/kubelet \
      -v docker-var-log:/var/log \
      --tmpfs /run \
      -e MOUNT_PROPAGATION="/" \
      mbentley/docker-in-docker \
      dockerd -s overlay2 -H unix:///var/run/docker.sock -H tcp://0.0.0.0:2375
    
  2. Communicate with that engine

    docker -H tcp://localhost:1000 info
    
  3. Check version

    docker -H tcp://localhost:1000 version
    
  4. Destroy the Engine

    docker kill docker
    docker rm docker
    docker volume rm docker
    

Swarm mode cluster

  1. Create 3 engines

    for ENGINE_NUM in {1..3}
    do
      docker run -d \
        --name docker${ENGINE_NUM} \
        --hostname docker${ENGINE_NUM} \
        --restart unless-stopped \
        --privileged \
        -p 127.0.0.1:100${ENGINE_NUM}:2375 \
        -v /lib/modules:/lib/modules:ro \
        -v docker${ENGINE_NUM}-root:/root \
        -v docker${ENGINE_NUM}-var-lib-docker:/var/lib/docker \
        -v docker${ENGINE_NUM}-etc-docker:/etc/docker \
        -v docker${ENGINE_NUM}-etc-cni:/etc/cni \
        -v docker${ENGINE_NUM}-opt-cni:/opt/cni \
        -v docker${ENGINE_NUM}-usr-libexec-kubernetes:/usr/libexec/kubernetes \
        -v docker${ENGINE_NUM}-var-lib-kubelet:/var/lib/kubelet \
        -v docker${ENGINE_NUM}-var-log:/var/log \
        --tmpfs /run \
        -e MOUNT_PROPAGATION="/" \
        mbentley/docker-in-docker \
        dockerd -s overlay2 -H unix:///var/run/docker.sock -H tcp://0.0.0.0:2375
    done
    
  2. Create a new Swarm

    docker -H tcp://localhost:1001 swarm init
    
  3. Get the worker join token and command

    TOKEN=$(docker -H tcp://localhost:1001 swarm join-token worker -q)
    JOIN_COMMAND="swarm join --token ${TOKEN} $(docker container inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' docker1):2377"
    
  4. Join engine 2

    docker -H tcp://localhost:1002 ${JOIN_COMMAND}
    
  5. Join engine 3

    docker -H tcp://localhost:1003 ${JOIN_COMMAND}
    
  6. Check status

    docker -H tcp://localhost:1001 node ls
    
  7. Destroy Swarm cluster

    docker kill docker1 docker2 docker3
    docker rm docker1 docker2 docker3
    docker volume rm docker1 docker2 docker3
    

About

Run one or many Docker daemons inside Docker as containers

Resources

Releases

No releases published

Packages

No packages published

Languages

You can’t perform that action at this time.