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



I’m trying to run a docker command inside of my build image. Bazel is running the docker command with the following invocation and error:

/bin/bash -c 'source external/bazel_tools/tools/genrule/; mkdir docker && cp -L receiver/Dockerfile bazel-out/local-fastbuild/bin/receiver/src/receiver/receiver.a bazel-out/local-fastbuild/bin/receiver/src/receiver/receiver docker && docker build docker -t gyroscope-receiver-dev > bazel-out/local-fastbuild/genfiles/receiver/docker_output'): Process exited with status 1. Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Are y’all doing something magic to docker commands to get them to connect to the remote host or should /var/run/docker.sock be enough to trigger it? I have a run: docker build foo command that is working fine running before this one executed by bazel fails.

Running dockerized services as part of integration tests
View docker logs of build failure

stat /var/run/docker.sock says that the file isn’t there…

The setup docker step outputs the following:

Allocating a remote Docker Engine

Remote Docker engine created. Using VM 'prealloc-tji6wyfa-1493165142313’
Created container accessible with:

Is it setting those environment variables? Should I be using them in my docker command somehow?

Aaah, I bet bazel is stripping those environment variables out, so I’ll have to pass them through somehow.


Yes, passing those environment variables through made things connect


This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.