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

build-image
docker

#1

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/genrule-setup.sh; 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'): com.google.devtools.build.lib.shell.BadExitStatusException: 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
#2

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:
DOCKER_TLS_VERIFY=1
DOCKER_HOST=tcp://35.190.128.29:2376
DOCKER_CERT_PATH=/tmp/docker-certs683304440
DOCKER_MACHINE_NAME=84380

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.


#3

Yes, passing those environment variables through made things connect


#4

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