Use docker dint in jobs


I want to build a docker image in a job and I tried using docker:dind image as part of my executor for this stage but I get the error:

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

I’ve searched a lot and I found setup_remote_docker but this nice feature has very limited resources and it takes a long time for my image to build and it’s not configurable.

any thoughts on how to get that docker daemon running?

seems like the default entrypoint is changing in circleci.

my configurations:

version: 2.1

      - image: 'docker:stable-dind'
    resource_class: small

    executor: dind-executor
      - run:
          name: Docker build
          command: 'docker build -t dashboard:latest .'
      - run:
          name: Docker login
          command: 'docker login -u _json_key -p "$GCLOUD_SERVICE_KEY"'
      - run:
          name: Docker push
          command: 'docker push dashboard:latest'

:wave: Hi @irLinja! Welcome to the CircleCI community!

The situation you’re facing is described in this article: it is not possible to build Docker images in your primary Docker container.

As you found out, you must use a remote Docker environment.

That said, if you need to have more control over the environment you’re using to build the Docker image, I suggest using the machine executor.

Let me know if this helps.