Docker-compose can't connect to daemon

I’m having an issue where the docker client has no problem connecting to the daemon but docker-compose does in my build.

setup_remote_docker output:

Allocating a remote Docker Engine

Assigned Docker Engine request id: 11738349
  provisioning: ...
Remote Docker engine created. Using VM 'default-b40d2efc-9ddb-4c8a-8d8c-fd0f7814e834'
Created container accessible with:
  DOCKER_TLS_VERIFY=1
  DOCKER_HOST=tcp://x.x.x.x:2376
  DOCKER_CERT_PATH=/tmp/docker-certs814008985
  DOCKER_MACHINE_NAME=11738349

but then later I have a run step that looks like:

- run:
  name: Build app image
  command: docker-compose build

… and it outputs:

#!/bin/bash -eo pipefail
docker-compose build
Building cnn-apps-showcase
ERROR: Couldn't connect to Docker daemon at https://x.x.x.x:2376 - is it running?

If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
Exited with code 1

(I x’ed out the IP but it is identical)

I ssh’ed into the container and found that DOCKER_HOST was set as expected.

What’s interesting is I more or less duplicated the config.yml of another project, where this build seems to be working just fine.

Has anybody else run into this? I’m perplexed!

That’s odd, Docker Compose worked for me without fuss. What base image are you using? I’m using docker:17.05.0-ce-git. However note I installed my own copy of DC (I think it is not installed in this image), so maybe that is why it worked.

Can we see the whole of your config.yml file?

After some more digging, I ultimately found that the issue was a / getting injected into the image field in my docker compose config file.

It’s not entirely clear to me why this problem was manifested in a docker daemon connection error when running in circleci. When I use the same base build container locally I get a more accurate ERROR: invalid reference format.

In any case, thanks for your help.

1 Like

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