Git Product home page Git Product logo

concourse-dcind's Introduction

Concourse Docker-Compose-in-Docker

Optimized for use with Concourse CI.

The image is Alpine based, and includes Docker, Docker Compose, and Docker Squash, as well as Bash.

Image published to Docker Hub: karlkfi/concourse-dcind.

Inspired by meAmidos/dcind, concourse/docker-image-resource, and mesosphere/mesos-slave-dind.

Features

Unlike meAmidos/dcind, this image...

  • Does not require the user to manually start docker.
  • Uses errexit, pipefail, and nounset.
  • Configures timeout (DOCKERD_TIMEOUT) on dockerd start to account for mis-configuration (docker log will be output).
  • Accepts arbitrary dockerd arguments via optional DOCKER_OPTS environment variable.
  • Passes through --garden-mtu from the parent Gardian container if --mtu is not specified in DOCKER_OPTS.
  • Sets --data-root /scratch/docker to bypass the graph filesystem if --data-root is not specified in DOCKER_OPTS.

Build

docker build -t karlkfi/concourse-dcind .

Example

Here is an example of a Concourse job that uses karlkfi/concourse-dcind image to run a bunch of containers in a task, and then runs the integration test suite. You can find a full version of this example in the example directory.

jobs:
- name: integration
  plan:
  - get: code
    params:
      depth: 1
    passed:
    - unit-tests
    trigger: true
  - task: integration-tests
    privileged: true
    config:
      platform: linux
      image_resource:
        type: docker-image
        source:
          repository: karlkfi/concourse-dcind
      inputs:
      - name: code
      run:
        path: entrypoint.sh
        args:
        - bash
        - -ceux
        - |
          # start containers
          docker-compose -f code/example/integration.yml run tests
          # stop and remove containers
          docker-compose -f code/example/integration.yml down
          # remove volumes
          docker volume rm $(docker volume ls -q)

concourse-dcind's People

Contributors

andibraeu avatar karlkfi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

concourse-dcind's Issues

Couldn't connect to Docker daemon at http+docker://localhost

Hi,

Followed the example configuration and got he error above, I did not dig deeper, wanted to drop a question while I investigate. Please let me know if I am missing any configuration, Previous I was using amidos/dcind. Trying to test it out, as I have been have some stability issues with that image.

Thank youl

Cannot connect to the Docker daemon (Concourse)

Hi Karlkfi,
I'm having issues using your image. Here is the error I'm receiving when running in Concourse:

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

This is the build.yaml

---
platform: linux

image_resource:
  type: docker-image
  source:
    repository: karlkfi/concourse-dcind
    tag: latest

inputs:
  - name: pipeline_repo
  - name: src_repo
  - name: release_artifacts

outputs:
  - name: src_repo

params:
  dockerfile_location:
  svc_name:
#  git_comitt_sha:

run:
  path: pipeline_repo/tasks/docker/build.sh

It doesn't even have the chance to connect to Docker to run the commands in the build.sh.

Am I missing something? Is your entrypoint.sh required?

Thanks =]

Issue mounting files

Hey, I'm getting this error mounting an nginx conf file into my container. I suspect the source of this error is the fact that I am running the docker-in-concourse commands on the docker daemon mounted from my host machine (see -H socat:1234) - I can't tell why this 'not a directory' error is occurring though.

docker-compose (concourse deployment) (to show how the daemon is mounted)

  socat:
    image: alpine/socat:1.0.3
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    command:
      - TCP-LISTEN:1234,fork
      - UNIX-CONNECT:/var/run/docker.sock

docker-compose (pipeline'd project)

      volumes:
          - ./nginx.conf:/etc/nginx/nginx.conf:ro

Job:

- name: deploy
    serial: true
    plan:
      - get: git-repo
        trigger: true
        passed: [build]
      - task: deploy
        privileged: true
        config:
          platform: linux
          image_resource:
            type: docker-image
            source:
              repository: karlkfi/concourse-dcind
          inputs:
            - name: git-repo
          run:
            path: entrypoint.sh
            args:
              - bash
              - -ceux
              - |
                docker-compose -f git-repo/docker-compose.yml -H socat:1234 down
                docker-compose -f git-repo/docker-compose.yml -H socat:1234 up --build -d

Error:

ERROR: for git-repo_nginx_1 Cannot start service nginx: OCI runtime create failed: container_linux.go:349: 
starting container process caused "process_linux.go:449: container init caused \"rootfs_linux.go:58: 
mounting \\\"/tmp/build/b0d51b9f/git-repo/nginx.conf\\\" to rootfs 
\\\"/var/lib/docker/overlay2/ad53263c3148bcc93b53a45b97a0fd3d3a3e60b92feca3d23965afd22cf23c19/merged\\\" at 
\\\"/var/lib/docker/overlay2/ad53263c3148bcc93b53a45b97a0fd3d3a3e60b92feca3d23965afd22cf23c19/merged/etc/nginx/nginx.conf\\\" 
caused \\\"not a directory\\\"\"": unknown: 
Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.