compose-cli icon indicating copy to clipboard operation
compose-cli copied to clipboard

ECS context does not support custom Docker Endpoint

Open tmeijn opened this issue 3 years ago • 0 comments

Description

When using the ECS context, it does not support overriding the Docker endpoint with DOCKER_HOST variable or in the configuration:

$ docker context create --docker host=tcp://docker:2376 ecs ecs  --from-env
Successfully created ecs context "ecs"

$ docker context list
NAME                TYPE                DESCRIPTION                               DOCKER ENDPOINT               KUBERNETES ENDPOINT   ORCHESTRATOR
default             moby                Current DOCKER_HOST based configuration   unix:///var/run/docker.sock                         swarm
ecs*                ecs                 credentials read from environment                                                                                                                   

Use case

I'm currently experimenting using the CLI to deploy Review Apps using Gitlab CI. I'm using the Gitlab.com Shared Runners, so Docker is running as a "Service".

I'm building and pushing the image fine using the default context:

docker compose build
docker compose push

But when I try to spin up the ECS services with docker --context=ecs compose up -d, I get the following error:

The new 'docker compose' command is currently experimental. To provide feedback or request new features please open issues at https://github.com/docker/compose-cli
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Suggesting it's not respecting the configuration setting nor the DOCKER_HOST variable which is set as CI/CD variable in Gitlab CI.

Describe the results you expected:

I would expect ecs context type to respect the Docker endpoint configuration.

Output of docker version:

$ docker version
Client: Docker Engine - Community
 Cloud integration: 1.0.11
 Version:           20.10.5
 API version:       1.41
 Go version:        go1.13.15
 Git commit:        55c4c88
 Built:             Tue Mar  2 20:14:11 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true
Server: Docker Engine - Community
 Engine:
  Version:          20.10.5
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       363e9a8
  Built:            Tue Mar  2 20:18:31 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.4.3
  GitCommit:        269548fa27e0089a8b8278fc4fc781d7f65a939b
 runc:
  Version:          1.0.0-rc93
  GitCommit:        12644e614e25b05da6fd08a38ffa0cfe1903fdec
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Output of docker info:

$ docker --context=default info
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)

Server:
 Containers: 11
  Running: 0
  Paused: 0
  Stopped: 11
 Images: 25
 Server Version: 20.10.5
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc io.containerd.runc.v2 io.containerd.runtime.v1.linux
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 05f951a3781f4f2c1911b05e61c160e9c30eaa8e
 runc version: 12644e614e25b05da6fd08a38ffa0cfe1903fdec
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: default
 Kernel Version: 5.8.0-45-generic
 Operating System: Ubuntu 20.10
 OSType: linux
 Architecture: x86_64
 CPUs: 12
 Total Memory: 31.08GiB
 Name: tmeijn-NHxxRZQ
 ID: GAPM:YYBE:NYV5:F4NC:UTXI:A5WZ:VUG4:LEJZ:N3WA:DLXX:XVYR:5NB7
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Username: tmeijn
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Additional environment details (AWS ECS, Azure ACI, local, etc.):

AWS ECS, local (CI) build & push

Note: seems related to #1385

tmeijn avatar Apr 01 '21 20:04 tmeijn