Cannot connect to docker daemon


I am creating a base image based off of ubuntu:14.04. I need to run docker from within this image on circle. I installed docker-engine on the image (in my Dockerfile). I also added the steps listed above to “Install docker engine”. However, I keep seeing the error “Cannot connect to docker daemon…”. Any ideas on how to run Docker-in-docker on circle?

Inside circle,

docker --version
Docker version 1.12.6, build 78d1802


docker run hello-world
docker: Cannot connect to the Docker daemon. Is the docker daemon running on this host?.
See 'docker run --help'.
Exited with code 125

Thanks a lot

Getting Started: Docker Engine

Did you run the other steps? They are not necessary in the machine version.

      - type: checkout
      - type: shell
        name: Install Docker Client
        command: |
          echo "test"
          curl -L -o /tmp/docker.tgz
          tar -xz -C /tmp -f /tmp/docker.tgz
          mv /tmp/docker/docker* /usr/bin/

          curl -L "$(uname -s)-$(uname -m)" -o /usr/bin/docker-compose
          chmod +x  /usr/bin/docker-compose

      - type: setup-docker-engine
      - type: shell
        name: Verify Docker Works
        command: |
          docker --version
          docker run hello-world


@rohara, thanks for your reply. That worked, thanks. I was actually not running the setup-docker-engine step :). One more question. Previously, there was an env variable called CIRCLE_ARTIFACTS. is there an equivalent in circle2?


@suchitagarwal No. Ricardo has documented some info on the env vars: CircleCI Environment Variables - 1.0 vs 2.0

Instead, just use artifacts-store and specify where your artifacts can be found.


@rohara, thanks. Sounds good, I will try that. Also, is there any way to tell circle to run setup-docker-engine only if it is on a certain branch?


@suchitagarwal Not yet but I definitely understand the use case for that.