Docker Community Forums

Share and learn in the Docker community.

Docker-compose does not use docker endpoint set via docker context

I am using docker-cli and docker-compose on my mac, installed via Docker for Mac.

I am not using the docker engine on the mac but I’ve used docker context to use some other host on my network.

For docker commands everything goes as expected, all commands invoked with the docker command are executed on the remote docker engine.

When I try to use docker-compose, it gives me an error:
ERROR: Couldn't connect to Docker daemon. You might need to start Docker for Mac.
This is as expected: I am not using that.

I did notice that if I prepend my docker-compose command with DOCKER_HOST=tcp://xxx:1234 it does work. I was using docker context to avoid setting this environment variable.

Is this a bug or a feature request or am I using it not correctly? I am not sure where to report so that is why I put the request here first. I would assume that docker-compose is able to use the same endpoint set via docker context.

Version information:

Client: Docker Engine - Community
 Version:           19.03.1
 API version:       1.40
 Go version:        go1.12.5
 Git commit:        74b1e89
 Built:             Thu Jul 25 21:18:17 2019
 OS/Arch:           darwin/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.1
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.5
  Git commit:       74b1e89
  Built:            Thu Jul 25 21:19:41 2019
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.6
  GitCommit:        894b81a4b802e4eb2a91d1ce216b8817763c29fb
 runc:
  Version:          1.0.0-rc8
  GitCommit:        425e105d5a03fabd737a126ad93d62a9eeede87f
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683
 Kubernetes:
  Version:          v1.13.6-gke.13
  StackAPI:         Unknown

docker-compose version 1.24.1, build 4667896b
docker-py version: 3.7.3
CPython version: 3.6.8
OpenSSL version: OpenSSL 1.1.0j  20 Nov 2018